You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SocketException occurring on database access (OSX) #881
I seem to have a sporadic SocketException occurring when using PostGres on OSX
Here below I ran the update command once, it failed, I ran it again 5 seconds later, and it performed fine.
I've seem the same error happening during application runtime when attempting to access entities via a context (i.e. db.Blogs.Where(...))
eftest master % dnx ef database update -c ApplicationDbContext
System.Net.Sockets.SocketException: Unknown error: -1
at System.Net.Sockets.Socket.Select(IList checkRead, IList checkWrite, IList checkError, Int32 microSeconds)
at Npgsql.NpgsqlConnector.Connect(NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnector.Open()
at Npgsql.NpgsqlConnectorPool.GetPooledConnector(NpgsqlConnection Connection)
at Npgsql.NpgsqlConnectorPool.RequestConnector(NpgsqlConnection connection)
at Npgsql.NpgsqlConnection.OpenInternal(NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnection.Open()
at Microsoft.Data.Entity.Storage.RelationalConnection.Open()
at Microsoft.Data.Entity.Storage.Internal.NpgsqlDatabaseCreator.Exists()
at Microsoft.Data.Entity.Migrations.HistoryRepository.Exists()
at Microsoft.Data.Entity.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.Data.Entity.Design.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
at Microsoft.Data.Entity.Commands.Program.Executor.Execute(Action action)
Unknown error: -1
eftest master % dnx ef database update -c ApplicationDbContext
Applying migration '20151123030314_AddIdentity'.
Done.
eftest master %
I see the issue here #874 and am not sure if it's related.
Has anyone else run into this and have any solution or workaround?
It's only an inconvenience during development, but completely blocks me from deploying to production.
Although this looks very close to where #874 happens, in this case this looks to be an actual failure / exception thrown by the Select() method method.
It's clear you are running this with dnx, but what's not clear to me, what is the runtime this is happening on? Is it CoreCLR by definition, or is this mono + dnx?
I'll try to get a hold of an OS X machine and see what gives
There is a chance that the fix in Select() will only fix the Linux behavior, and we will still see breakage in OS X, since API differences between implementations of BSD socket api do exist and ultimately lead to these sort breakages.
In short, lets reconvene here once MS releases "new and improved" CoreCLR implementation of Select() and see if that obviates the problem
@damageboy Just FYI: I have exactly same issue on OSX without EF, though not sporadically but constantly: I can't even run a single query. Mono on OSX and CoreCLR on Windows work fine with the same code/db server.
DNVM: 1.0.0-rc1-update1 coreclr x64 darwin
npgsql: 3.1.0-alpha6
Stacktrace:
System.Net.Sockets.SocketException: Unknown error: -1
at System.Net.Sockets.Socket.Poll(Int32 microSeconds, SelectMode mode)
at System.Net.Sockets.Socket.get_Connected()
at System.Net.Sockets.NetworkStream.InitNetworkStream(Socket socket)
at System.Net.Sockets.NetworkStream..ctor(Socket socket, Boolean ownsSocket)
at Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnector.Open()
at Npgsql.NpgsqlConnectorPool.GetPooledConnector(NpgsqlConnection Connection)
at Npgsql.NpgsqlConnectorPool.RequestConnector(NpgsqlConnection connection)
at Npgsql.NpgsqlConnection.OpenInternal(NpgsqlTimeout timeout)
at Npgsql.NpgsqlConnection.Open()
Activity
damageboy commentedon Nov 23, 2015
Although this looks very close to where #874 happens, in this case this looks to be an actual failure / exception thrown by the
Select()method method.It's clear you are running this with
dnx, but what's not clear to me, what is the runtime this is happening on? Is it CoreCLR by definition, or is this mono + dnx?I'll try to get a hold of an OS X machine and see what gives
Banashek commentedon Nov 24, 2015
This is dnx with coreclr.
1.0.0-rc1-final coreclr x64 darwin default
damageboy commentedon Nov 24, 2015
Hi @Banashek, since #874 ultimately led to be a bug in CoreCLR with
Select()(https://github.com/dotnet/corefx/issues/4631) and there is a general fix on the way, I want to wait for their fix.There is a chance that the fix in
Select()will only fix the Linux behavior, and we will still see breakage in OS X, since API differences between implementations of BSD socket api do exist and ultimately lead to these sort breakages.In short, lets reconvene here once MS releases "new and improved" CoreCLR implementation of
Select()and see if that obviates the problempavelbrylov commentedon Dec 13, 2015
@damageboy Just FYI: I have exactly same issue on OSX without EF, though not sporadically but constantly: I can't even run a single query. Mono on OSX and CoreCLR on Windows work fine with the same code/db server.
DNVM: 1.0.0-rc1-update1 coreclr x64 darwin
npgsql: 3.1.0-alpha6
Stacktrace:
xanather commentedon Dec 15, 2015
I also have this problem on Ubuntu 14.04. You can try get an update version of System.Net.Sockets https://myget.org/gallery/dotnet-core and see if it fixes it. I may try this tomorrow.
pavelbrylov commentedon Dec 16, 2015
Removed my comment, can confirm it works fine on
jchannon commentedon Dec 21, 2015
Found same issue with
1.0.0-rc1-finalbut updated to latest unstable feed1.0.0-rc2-16343and seems fixedroji commentedon May 8, 2016
Closing as fixed, please comment if otherwise.