[Mono-dev] TCP Async

Yuriy Solodkyy yuriy at couldbedone.com
Fri Jul 6 21:49:22 UTC 2012

Hi Rodrigo,

please find a small sample app at https://github.com/ysw/mono-socket-problem

This app can start in either server or client mode.  These modes only
differ in whether it listens for connections on multiple ports or
connects to server on multiple ports. Upon connecting to or accepting
connection it immediately sends some data, and then sends next chunk
of data in response to any data received from the other side.  There
are some random delays in code and we limit outgoing traffic on each
connection not to be significantly higher than inbound.

There is also a separate thread which regularly checks status of every
connection and report any connections that are awaiting a callback,
but their status obtained with socket.poll is already READY.  (A
several seconds delay is still allowed).

See also the README file.

Also, it seems that constantly changing men/max threads in ThreadPool
increases probability of the problem. See code.
Please let me know if this sample app works for you.

Hope it helps

Thank you,

We've been aware of such issues, could you file a bug and attach a test
case with it please?

This would really really help us fix it.

On Wed, Jun 27, 2012 at 4:08 AM, Greg Young <gregoryyoung1 at gmail.com> wrote:

> We are experiencing an issue with async behaviours in sockets (with
> SendAsync/callback not Begin/End).
> Our visible issue is that when in a send loop we will fail on our
> heartbeats. After debugging and counting calls into/out of
> SendAsync/callback we see that we are inside of a call to SendAsync
> (eg: it never returns, in our case for 10 seconds before we declare
> the socket dead). We can duplicate this fairly regularly on
> mac/bsd/linux though its nonconsistent (sometimes it may happen
> repeatedly other times it works fine). The code does not have such
> issues on MS CLR. We are also running on loopback so its unlikely that
> an underlying network problem is causing the hang up. The code itself
> is fairly straight forward (not that different than the MS example of
> the API except that its fully async (separate send/receive loops while
> the example is request/response))
> I am pulling sources now to build latest but does anyone happen to
> know of known issues with this sort of thing?
> Cheers,
> Greg
> --
> Le doute n'est pas une condition agréable, mais la certitude est absurde.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

Yuriy Solodkyy
(y.solodkyy at gmail.com)

More information about the Mono-devel-list mailing list