[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:

**
(/usr/lib/mono/gac/mono-service/2.0.0.0__0738eb9f132ed756/mono-service.exe:15324):
WARNING **: CreateThread: error creating thread handle

**
(/usr/lib/mono/gac/mono-service/2.0.0.0__0738eb9f132ed756/mono-service.exe:15324):
WARNING **: ves_icall_System_Threading_Thread_Thread_internal:
CreateThread error 0x1f

**
(/usr/lib/mono/gac/mono-service/2.0.0.0__0738eb9f132ed756/mono-service.exe:15324):
WARNING **: _wapi_thread_abandon_mutexes: error looking up thread handle
0x1b91

**
(/usr/lib/mono/gac/mono-service/2.0.0.0__0738eb9f132ed756/mono-service.exe:15324):
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,

Noix


More information about the Mono-list mailing list