[Mono-dev] Possible bug in System.Net.Sockets.Socket?

Esben Laursen hyber at hyber.dk
Tue Jan 29 11:47:30 UTC 2013


Hi Guys,

This my first post to the develop list, so I have that I have found the 
correct place for my questions.

I have a problem with the sharpsnmplib 
(http://sharpsnmplib.codeplex.com/) that when I run mono-3.0.3 it halts 
my program even tough I have set a time-out of 3000ms on the socket. I 
have a watchdog that after about 10minutes reset the thread and tries again.

I am fairly convinced that it is a problem in the framework, but of 
course not sure.

I tried to build a reproduction of my problem where I implemented my 
method as Async with a waitone time-out of twice the socket time-out. It 
happens from time to time that the waitone would trigger before the 
time-out of the socket. (I tested this on 2.6.7, 2.10.8 and 3.0.3 and 
they all had the issue)

That lead me to build a simple udp socket client and server app.

It works the following way:

Client sends a UDP packet to the server
The server reads the socket and returns the same data back to the client
Client reads the socket and closes it
Then loop back to the beginning.

This works great on Windows (and mono if you run both apps locally)

Then I tested with the server app running on my Windows7 and the client 
app running on a Debian (tried both 2.6.7 and 3.0.3) and it would only 
send out 20-30 udp packets before it would that giving me this output to 
the console:

Operation on non-blocking socket would block
Operation on non-blocking socket would block
Operation on non-blocking socket would block
Operation on non-blocking socket would block
Operation on non-blocking socket would block

after a little while it would send out some more packets.

Here is a link to my code: http://pastebin.com/3ehqSpWM

The question is the following:

1. I guess this is a bug, should I create it in bugzilla?

2. If I have a multithreaded app that sends out hundreds or thousand of 
UDP requests, do you think this could cause the socket to be block for 
10 minutes at a time? I am not sure its the same problem and the problem 
I have with my code seems to be worse on mono-3.0.3, but not worse in my 
reproduction app (although it is not threaded)

What are your thoughts?

Many thanks for your help.

Cheers

Esben



More information about the Mono-devel-list mailing list