delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/08/07/14:54:48

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=aSk1CbfH8SUBHH6TDnvn6CHuyxI5zHhHp9EpUEtfDWh
/bGUWFVh4zgzDkBjgi8kuGr9u7GSldtyrAdobjoOQEKWsRg6/0w9wA0zNKdxj0Ri
jxH4vHtj/wRrPzmlqbTS6xOj03w8aVOIgo5xDTJ2Wzf3WW1w6sPquf01mLCFhIag
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=A8fX6nP0g9N0f32jjY/CgV5NzZY=; b=klWk7owIUhuNdcsNr
aVHUb92cbmn1DHdBeNBuClC1neV0aNyX6amWiEAVOZkkhqQRhmsSXl6Hq/GBphwp
D5t+VRUVZV9mBk3suA9P7a/Oy5ThbndSgqrGGJb0TTZT2QvoHsGu4GmIo7+wqgQh
W2TjeIRUds8tPou2UdPVsnwRak=
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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2
X-HELO: limerock03.mail.cornell.edu
X-CornellRouted: This message has been Routed already.
Message-ID: <53E3CB46.1020909@cornell.edu>
Date: Thu, 07 Aug 2014 14:53:58 -0400
From: Ken Brown <kbrown AT cornell DOT edu>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: (call-process ...) hangs in emacs
References: <53DB8D23 DOT 7060806 AT alice DOT it> <CAK9Gx1cjj-7cDP7CunD7Bxz35L+SU9+4Ro3HRot5cwjcArudOA AT mail DOT gmail DOT com> <20140801133225 DOT GD25860 AT calimero DOT vinschen DOT de> <53DEDBBA DOT 20102 AT cornell DOT edu> <20140804080034 DOT GA2578 AT calimero DOT vinschen DOT de> <53DF8BDC DOT 8090104 AT cornell DOT edu> <20140804134526 DOT GK2578 AT calimero DOT vinschen DOT de> <53E0CC2D DOT 4080305 AT cornell DOT edu> <20140805135830 DOT GA9994 AT calimero DOT vinschen DOT de> <53E11A93 DOT 9070800 AT cornell DOT edu> <20140805184047 DOT GC13601 AT calimero DOT vinschen DOT de> <53E3685B DOT 8050508 AT cornell DOT edu> <53E39BAD DOT 3010004 AT redhat DOT com>
In-Reply-To: <53E39BAD.3010004@redhat.com>
X-IsSubscribed: yes

On 8/7/2014 11:30 AM, Eric Blake wrote:
> On 08/07/2014 05:51 AM, Ken Brown wrote:
>>
>> I think I found the problem with NORMAL mutexes.  emacs calls
>> pthread_atfork after initializing the mutexes, and the resulting
>> 'prepare' handler locks the mutexes.  (The parent and child handlers
>> unlock them.)  So when emacs calls fork, the mutexes are locked, and
>> shortly thereafter the Cygwin DLL calls calloc, leading to a deadlock.
>> Here's a gdb backtrace showing the sequence of calls:
>
> Arguably, that's an upstream bug in emacs.  POSIX has declared
> pthread_atfork to be fundamentally useless; it is broken by design,
> because you cannot use it for anything that is not async-signal-safe
> without risking deadlock.  And (except for sem_post()), NONE of the
> standardized locking functions are async-signal-safe.
>
> http://austingroupbugs.net/view.php?id=858
>
> That said, it would still be nice to support this, since even though the
> theory says it is broken, there are still lots of (broken)
> programs/libraries still trying to use it.

So what do you think emacs should do instead of using pthread_atfork? 
Or is it better to just remove it?  I don't know how likely it is that 
this would cause a problem.

Ken

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