Repository navigation
Closed
Labels
Milestone
Description
Here is an other application which makes the stack trace more clear:
try
{
try
{
socket.Connect(ep);
}
catch (SocketException e)
{
=> The socket exception is catched here!
Console.WriteLine("Excpetion Message=" + e.Message);
Console.WriteLine("Excpetion Stack=" + e.StackTrace);
Console.WriteLine("Socket Error Code=" + e.SocketErrorCode.ToString());
if (e.SocketErrorCode != SocketError.WouldBlock)
{
throw;
}
}
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)
{
Console.WriteLine("error code is not zero!");
throw new SocketException((int)socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error));
}
if (!write.Any())
{
Console.WriteLine(
$"Timeout after {new TimeSpan(perIpTimeout * 10).TotalSeconds} seconds when connecting to {ips[0]}");
try { socket.Dispose(); }
catch
{
// ignored
}
// if i == 0
Console.WriteLine("i==0 exception");
throw new TimeoutException();
// continue;
}
socket.Blocking = true;
return;
}
catch (TimeoutException) { throw; }
catch
{
try { socket.Dispose(); }
catch
{
// ignored
}
Console.WriteLine("Failed to connect to " + ips[0]);
// if (i == 0)
Console.WriteLine("i==0 exception 2");
throw;
}Here is my output from the above program:
Excpetion Message=Unknown error 10035
Excpetion Stack= at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at SirenTek.Program.Main(String[] args)
Socket Error Code=WouldBlock
Timeout after -1E-06 seconds when connecting to 192.168.1.72
i==0 exception
System.TimeoutException: The operation has timed out.
Socket.DoConnect method creates an exception. This makes us unable to use npgsql with core50 runtime.
Activity
joshfree commentedon Nov 30, 2015
@sirentek is this issue on linux per https://github.com/dotnet/corefx/issues/4631?
sirentek commentedon Nov 30, 2015
I use https://myget.org/gallery/dotnet-core as feed.
System.Net.Sockets v4.1.0-rc2-23530.
runtime as coreclr-rc2-16177
linux mint 17.2
@joshfree yes, it still resists..
FYI: I have mono 4.2 installed and I don't get this exception when using mono runtime 1.0.0-beta8 with dnx451.
kferrio commentedon Feb 2, 2016
There is a very helpful discussion here of the socket issue and how it is affecting Npgsql on coreclr. No solution, but a workaround if you're able to use mono instead. As others have noted, a fix was merged to coreclr some time ago and is slated for milestone rc-2. As of today there are still 73 open issues against milestone rc-2.
ericeil commentedon Feb 10, 2016
It sounds like this was fixed with dotnet/corefx#4652. If this still repros on current builds, please re-open this issue.
sirentek commentedon Feb 11, 2016
@ericeil
No, dotnet/corefx#4652 didn't fix it.
This bug is very important. It blocks using postgresql in linux environment with coreclr runtime.
Could you please re-open it ?
ericeil commentedon Feb 12, 2016
I had introduced a new bug that affected this code last week, fixed with dotnet/corefx#6075. Now that this is fixed, I'm able to run the following test (derived from your sample code) on both Windows and Ubuntu, successfully:
I will consider this closed for now; if you have a more representative test you can give me that still fails, even with the fix for dotnet/corefx#6075, please post it here.
Add test from example in #4733
sirentek commentedon Feb 15, 2016
@ericeil,
I used coreclr-rc2-16397 runtime and it worked for me in linux.
Thanks!