[Mono-list] tracking down "Thread creation failed"

Tomasz Noiński noix at sphere.pl
Tue Oct 23 11:52:48 EDT 2007

Hi list,

I'm writing a mono server application and recently I discovered that after
a few hours it crashes with "System.SystemException: Thread creation
failed." (thrown by System.Threading.Thread.Start when I try to create a
new thread).
Mono also outputs to stderr:

WARNING **: CreateThread: error creating thread handle

WARNING **: ves_icall_System_Threading_Thread_Thread_internal:
CreateThread error 0x1f

WARNING **: _wapi_thread_abandon_mutexes: error looking up thread handle

WARNING **: _wapi_thread_set_termination_details: error looking up thread
handle 0x1b91

I know it looks like I'm somehow leaking threads, but I try to track it
down with no luck.
I use a helper IDisposable object that writes "thread X starts" in the
constructor and "thread X exits" in Dispose() and use it (with a using(){}
statement) in every delegate I use for creating threads.
My log says that at the moment the exception is thrown there should
only be about ~30 threads (which is expected).

What can be the reasons for "Thread creation failed"?
What more can I do to track it down?
I do _not_ Join() any threads, could that be the reason?

Thanks in advance,


More information about the Mono-list mailing list