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
Connection time outs without any warning. An output about the reason is expected. #874
I run => dnx ef migrations add InitialMigration
done.
I run => dnx ef database update
System.TimeoutException: The operation has timed out.
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)
When I change the username or password or server or port or databasename, it creates the same System.TimeoutException.
Changing any parameter value doesn't have any effect in the result.
I think outputs such as "invalid user creditentals", "server doesn't exist" would be better.
It is the part of the NpgsqlConnector class, Connect() method.
var write = new List<Socket> { socket };
var error = new List<Socket> { socket };
Socket.Select(null, write, error, perIpTimeout);
var errorCode = (int) socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error);
if (errorCode != 0) {
throw new SocketException((int)socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error));
}
if (!write.Any())
{
Log.Warn(
$"Timeout after {new TimeSpan(perIpTimeout*10).TotalSeconds} seconds when connecting to {ips[i]}");
try { socket.Dispose(); }
catch
{
// ignored
}
if (i == ips.Length - 1)
{
throw new TimeoutException();
}
continue;
}
After the following line is called:
=>Socket.Select(null, write, error, perIpTimeout);
In Linux:
The list write doesn't have any elements after the following line is called:
As a result it enters the if (!write.Any()) block and creates "Timeout exception" there.
In Windows:
The list write has the element. It works.
So the problem seems to be at:
=>Socket.Select(null, write, error, perIpTimeout);
I don't have any idea why it behaves differently in Linux..
@damageboy I use CoreCLR. It was 1.0.0-rc2-16177.
Socket creates the exception. But this exception is catched and not thrown here in NpsqlConnector.cs:
if (e.SocketErrorCode != SocketError.WouldBlock)
{
throw;
}
So developer will never know when there is a socket exception at the time Socket.DoConnect() method is called. Actually the exception takes place at there and this makes Socket.Select() method behave different. I think problem is System.Net.Sockets package just as you mentioned pure CoreCLR issue.
For those who want to use ngpsql in linux : dnx mono runtime version beta8 works.
For dnx mono-rc runtime versions, updating mono installation to 4.3 is required.
System.TimeoutException: The operation has timed out.
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)
dnx --version
Microsoft .NET Execution environment
Version: 1.0.0-rc1-16609
Type: CoreClr
Architecture: x64
OS Name: Linux
OS Version: ubuntu 14.04
Runtime Id: ubuntu.14.04-x64
Activity
sirentek commentedon Nov 21, 2015
The database exists in a linux host.
When the client is Windows:
Works as expected.
When the client is Linux:
It doesn't connect. (Timeout exception)
It doesn't connect to localhost either. (Timeout exception)
roji commentedon Nov 21, 2015
@damageboy?
sirentek commentedon Nov 22, 2015
It is the part of the NpgsqlConnector class, Connect() method.
After the following line is called:
=>Socket.Select(null, write, error, perIpTimeout);
In Linux:
The list write doesn't have any elements after the following line is called:
As a result it enters the if (!write.Any()) block and creates "Timeout exception" there.
In Windows:
The list write has the element. It works.
So the problem seems to be at:
=>Socket.Select(null, write, error, perIpTimeout);
I don't have any idea why it behaves differently in Linux..
sirentek commentedon Nov 22, 2015
I think it may not be a Npgsql related issue. I have created an issue about Socket.Select() method here: https://github.com/dotnet/corefx/issues/4631
damageboy commentedon Nov 23, 2015
@sirentek It's not clear to me, what runtime exactly are you experiencing this on? Mono / CoreCLR?
damageboy commentedon Nov 23, 2015
@roji this doesn't look to be ef7 related to me, pure CoreCLR, IMO
sirentek commentedon Nov 23, 2015
@damageboy I use CoreCLR. It was 1.0.0-rc2-16177.
Socket creates the exception. But this exception is catched and not thrown here in NpsqlConnector.cs:
So developer will never know when there is a socket exception at the time Socket.DoConnect() method is called. Actually the exception takes place at there and this makes Socket.Select() method behave different. I think problem is System.Net.Sockets package just as you mentioned pure CoreCLR issue.
Should I close this issue ? ( I have already opened about this at https://github.com/dotnet/corefx/issues/4631 )
pgavlin commentedon Nov 23, 2015
This is a Linux-specific CoreFX issue. A fix is in progress.
damageboy commentedon Nov 23, 2015
Yeap, looks like this should be closed, I'll let you do the deed
sirentek commentedon Nov 23, 2015
@damageboy Thanks!
roji commentedon Dec 1, 2015
FYI https://github.com/dotnet/corefx/issues/4631 just got closed
sirentek commentedon Dec 1, 2015
https://github.com/dotnet/corefx/issues/4631 => fixes select method but the problem still resists.
I have tested the new libraries (system.net.sockets version rc2-530) using coreclr runtime and got the same error (connection time out).
This bug blocks us using ngpsql with coreclr runtime. So I created an other issue here:
Please see https://github.com/dotnet/corefx/issues/4733
For those who want to use ngpsql in linux : dnx mono runtime version beta8 works.
For dnx mono-rc runtime versions, updating mono installation to 4.3 is required.
thmulvany commentedon Jan 8, 2016
Anyone still having any issues (e.g. System.Net.Security, System.Net.NetworkInformation or PG timeout) in a .NET Core (not Mono) app using EF7 + NpgSql EF7 provider please see https://github.com/dotnet/corefx/issues/4631#issuecomment-165893079 and https://github.com/dotnet/corefx/issues/4631#issuecomment-169551945
tynar commentedon Apr 24, 2016
Same as Nickolas Acosta,
dnvm 1.0.0-rc2-15546,
dnx
Microsoft .NET Execution environment
Version: 1.0.0-rc1-16609
Type: CoreClr
Architecture: x64
OS Name: Linux
OS Version: ubuntu 14.04
Runtime Id: ubuntu.14.04-x64
postgre: 9.5
PcMaKeR commentedon May 2, 2016
Same problem:
dnx --version
Microsoft .NET Execution environment
Version: 1.0.0-rc1-16609
Type: CoreClr
Architecture: x64
OS Name: Linux
OS Version: ubuntu 14.04
Runtime Id: ubuntu.14.04-x64
EntityFramework and Npgsql versions:
"EntityFramework.Relational": "7.0.0-rc1-final", "EntityFramework7.Npgsql": "3.1.0-rc1-3", "EntityFramework7.Npgsql.Design": "3.1.0-rc1-5", "EntityFramework.Commands": "7.0.0-rc1-final", "EntityFramework.Core": "7.0.0-rc1-final", "EntityFramework.Relational.Design": "7.0.0-rc1-final", "Microsoft.Extensions.CodeGeneration.EntityFramework": "1.0.0-rc1-final",