[Mono-dev] [PATCH] TcpChannel hang on Windows.

Kornél Pál kornelpal at gmail.com
Fri Dec 19 17:37:03 EST 2008


Hi,

If you need a quick fix you patch will do it. But it is just a workaround.

What I suggested is that the bug is general, not related to Socket.Accept.

You wrote in your original message:

The problem is that the APC call does not cause the accept call to break.

My test case shows that the APC is executed even if accept is not leaved.

I don't know the exact solution because I don't know what the real bug is.

I just wanted to show you that Mono behaves the same as MS.NET except 
that the thread is not terminated at exit so I believe this is the 
difference rather than any hack in Socket.Accept.

The difference in thread state is a bug I believe that may cause other 
bugs if code checks for exact state value but I don't know if this is 
the case.

The fact that I used a managed APC is not required I just have written 
the test case in C#. I believe that in this case the thread is aborted 
because the wrapper checks for abortion.

Kornél

Bill Holmes wrote:
> Kornél,
> 
> After reading your mail a bunch more times and messing with the sample
> I think I finally get what you were saying.
> 
> What I discovered was that the APC callback being a managed method
> gives mono a chance to check the thread state when crossing to and
> from the managed thread boundary.  It is not the fact that you called
> an APC that was important.  What is important is that the APC was a
> managed call.
> 
> This does in fact give me some ideas on new things to try.  I will let
> you know what I find.  I suspect that my new conclusion will be a
> risky change that will require much testing.
> 
> -bill
> 


More information about the Mono-devel-list mailing list