From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25616 invoked by alias); 18 May 2012 10:23:19 -0000 Received: (qmail 25605 invoked by uid 22791); 18 May 2012 10:23:18 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from turboconrad.planet-school.de (HELO turboconrad.planet-school.de) (194.116.187.108) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 May 2012 10:23:04 +0000 Received: from turboconrad.planet-school.de (srv004.service.ps-server.net [194.116.186.79]) by turboconrad.planet-school.de (Postfix) with ESMTP id 834D6B6A06B for ; Fri, 18 May 2012 12:23:01 +0200 (CEST) Received: from [129.70.212.86] (TempleOfTheDog.ti.uni-bielefeld.de [129.70.212.86]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: thisaccountwillneverbechecked@sister-shadow.de) by turboconrad.planet-school.de (Postfix) with ESMTPSA id 68D0DB6A06A for ; Fri, 18 May 2012 12:23:01 +0200 (CEST) Message-ID: <4FB62304.2000100@sister-shadow.de> Date: Fri, 18 May 2012 10:23:00 -0000 From: Otto Meta Reply-To: cygwin@cygwin.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: 1.7.15-1: pthread_cancel and pthread_kill not working as expected References: <4FAAAE25.40204@sister-shadow.de> In-Reply-To: <4FAAAE25.40204@sister-shadow.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2012-05/txt/msg00386.txt.bz2 Greetings, as I got no response to my first question, I tried two older Cygwin versions to narrow down the problem. Maybe this’ll help someone to figure out the cause. I tried 1.7.9 and 1.7.12-1, with the results of 1.7.12-1 being exactly like the ones from 1.7.14-2 and 1.7.15-1. Unfortunately I couldn’t dig up any versions between 1.7.9 and 1.7.12-1. Results from 1.7.12-1 (for semaphores, detailed results in my last mail): Test 1: Main thread hangs on pthread_cancel() (PTHREAD_CANCEL_DEFERRED) Test 2: Threads ignore pthread_cancel() (PTHREAD_CANCEL_ASYNCHRONOUS) Test 3: Signals often wake the wrong thread Test 4: Wrong thread wakes up once, then nothing Test 5: Some threads exit, depending on whether the signal reached the right thread Test 6: Thread isn't cancelled even after a waking it with a signal On 1.7.9 things are a bit different: Test 1: PTHREAD_CANCEL_DEFERRED semaphore/pause: All threads are cancelled via pthread_cancel() read: No thread is cancelled Test 2: PTHREAD_CANCEL_ASYNCHRONOUS Threads ignore pthread_cancel() Test 3: semaphore/read: No thread wakes up or executes the signal handler, sleep() doesn't sleep any more after the first signal (returns immediately) pause: All threads wake up on every signal, correct thread executes signal handler Test 4: semaphore/read: No thread wakes up or executes the signal handler, sleep() doesn't sleep any more after the first signal (returns immediately) pause: All threads wake up on every signal, correct thread executes signal handler Test 5: semaphore: No thread is killed, sleep() doesn't sleep any more pause: First thread cancelled, other threads won't pause() any more and run amok read: Some threads are killed, sleep() doesn't sleep any more Test 6: semaphore/pause: No thread is killed, sleep() doesn't sleep any more pause: First thread cancelled, other threads won't pause() any more and run amok Sorry if I’m mixing two (or three?) problems, but they all seem pthreads-related. pthread_cancel deferred: Worked on threads blocked in sem_wait() and pause() in 1.7.9, doesn’t work any more in 1.7.12-1 and newer and instead hangs calling thread. I’d consider this one a regression. Didn’t work on threads blocked in read() in any tested version. pthread_cancel asynchronous: No thread is cancelled in any tested version. Calling thread doesn’t hang, though. pthread_kill: In 1.7.9 a signal to any thread wakes up all threads blocked in pause() and the correct thread executes the signal handler. Doesn’t wake threads blocked in sem_wait() or read(). After delivering a signal, pause() and sleep() don’t block any more and return immediately. In 1.7.12-1 and newer sleep() and pause() won’t break and not all threads are woken up. Instead only one thread is woken, but unfortunately not always the correct one. While signal handling mostly seems to have improved, cancelling got worse. Especially the fact that the calling thread blocks in pthread_cancel can be quite a show-stopper. Any suggestions or ideas? Cheers, Otto -- 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