This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Calling sem_wait() in DllMain( DLL_THREAD_DETACH) crashes

On Tue, Mar 15, 2011 at 06:34:27PM +0000, Jon TURNEY wrote:
>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, 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 :-)

Actually you aren't supposed to be able to call anything you like here and
it isn't clear why a POSIX/UNIX/Linux program would be relying on DllMain.


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]