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

Bill Holmes billholmes54 at gmail.com
Mon Dec 22 10:59:52 EST 2008


I do agree that this is a general problem and not only an issue with
accept.  Also I do know that the patch is a workaround, or as we like
to say treading the symptom and not that cause.

I have spent much time trying to understand the shutdown behavior of
MS.  From what I can gather I does appear that MS kills the thread or
simply ignores it.  (So we agree on that as well.)

For Mono I would suggest that killing all background threads on
shutdown.  (and only shutdown.)  Ignoring the thread and allowing it
to live on allows a window of opportunity to attempt to interact with
other Mono internal objects that have been destroyed.  Therefore
killing the thread I believe is the better option.

Another reason I believe that MS simply kills the thread is a
different sample I tried.  Consider a program that spawns a background
thread.  That thread only PInvokes into a call that simply loops.
(while (1);)  The program does exit with MS.Net.

I have discussed this on IRC with a few others and exiting the thread
is an unpopular solution.  Killing a thread is about as accepted as
using goto statements.  ;)

To be honest, even though I have spent 2 weeks looking at this I still
do not feel comfortable that the Mono shutdown logic can handle
killing threads.  Another way to put it I am afraid that changing the
shutdown logic would cause currently working Mono apps to start
bombing because I just do not understand the full picture.


More information about the Mono-devel-list mailing list