X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Message-ID: <4D7FB133.7030301@dronecode.org.uk> Date: Tue, 15 Mar 2011 18:34:27 +0000 From: Jon TURNEY User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Calling sem_wait() in DllMain( DLL_THREAD_DETACH) crashes Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 AT openssl DOT 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