This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Calling sem_wait() in DllMain( DLL_THREAD_DETACH) crashes
- From: Jon TURNEY <jon dot turney at dronecode dot org dot uk>
- To: cygwin at cygwin dot com
- Date: Tue, 15 Mar 2011 18:34:27 +0000
- Subject: Calling sem_wait() in DllMain( DLL_THREAD_DETACH) crashes
I've come across a problem whilst trying to run the twisted test suite, where
some tests just cause python to segfault. It seems to be the same issue with
libcrypto as reported in [2],[3]
A small test case is attached to [2] as cygwin_crash.zip, referred to in
msg76086, which shows that manipulating a semaphore in
DllMain(DLL_THREAD_DETACH) causes a crash.
There is a patch for openssl attached to [1] which makes sense to me. Surely
the cleanup ERR_remove_state() does should be requested using
pthread_cleanup_push() rather using DllMain(DLL_THREAD_DETACH)? But that
doesn't seem to be done for any other POSIX target. The documentation of
ERR_remove_state() gives me the impression that it expects the application to
arrange for that to happen, so perhaps it's just trying too hard to be
helpful here?
I suppose the alternative interpretation is that you are supposed to be able
to call anything you like from DllMain(DLL_THREAD_DETACH), then this is a
cygwin bug. But I can't see how that could be made work as pthread::exit() has
to delete the cygwin thread object before ExitThread() is called, as there's
no thread to do it in afterwards :-)
[1] http://www.mail-archive.com/openssl-dev@openssl.org/msg24599.html
[2] http://bugs.python.org/issue3947
[3] http://cygwin.com/ml/cygwin/2008-11/msg00341.html
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple