delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/20/05:50:53

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <4B067444.80900@ece.cmu.edu>
Date: Fri, 20 Nov 2009 11:49:40 +0100
From: Ryan Johnson <ryanjohn AT ece DOT cmu DOT edu>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Re: 1.5.25-15: pthread_join deadlocks
References: <20091119124405 DOT GF29173 AT calimero DOT vinschen DOT de>
In-Reply-To: <20091119124405.GF29173@calimero.vinschen.de>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Corinna Vinschen wrote:
> On Nov 19 12:29, Ryan Johnson wrote:
>   
>> Hi all,
>>
>> I'm hitting a deadlock with cygwin pthreads when joining on a
>> short-lived thread -- for me the second such thread creation will
>> almost never return. It looks *exactly* like a problem that others
>> noticed as far back as early 2005 [0], and  from the output of
>> strace on the test case (below) the culprit is almost certainly a
>> racy optimization in __cygwin_lock_* for which a patch was submitted
>> six months ago [1].
>>
>> As of today my cygwin distribution is completely up to date. Any
>> hope of an update coming out soon?
>>     
>
> The update will be Cygwin 1.7.  You testcase works fine for
> me on Cygwin 1.7, so maybe you should try this path.  See
> http://cygwin.com/#beta-test
>   
Ah, that's good to know. I'll try it out when I get a few minutes. 
Meanwhile, firing up an extra thread at program start, and having it 
just block on a cond var nobody will ever signal, seems to avoid the 
problem completely.

Out of curiosity, how much did removing the racy optimization hurt 
performance? The patch just yanked it completely iirc. An alternative 
might be to have the main thread check for single-thread environment 
only at acquire time, and then release only if it acquired (the latter 
is probably a good idea regardles...).

Thanks,
Ryan


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019