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; q=dns; s=default; b=tZRrMq ydZGt+rH7+wr88XMBWLVUNiOKQtqf1VZ9eQgYy00k7X3pQbzgpt1sDQA0Ub35IOf WGowpvxzxoLbD48/VZM8HU0sCX1Oi6ekFJNUf7U+lpDoKA26vD3GgmJaI3djYwj7 XMTtgCTX7/o8HdUcd16rd4eYIpMHYw+Ma8lpE= 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; s=default; bh=qnbb3PvrpVkx El57n8YoBjMFgag=; b=gVuUrHaqbVWJI1jXFnId8qxthq26O7nO86X768xf3Y6L HRsnP9aNWEEcwxqcTrXvVoJJn554iaaqo1awD8xSGXQ3T6vxrwmQGPcT9hehb//P GVk0of3XS/PDIB6bJcuJnEPvjMqSK7lLaVM/sA+5jQq5tF45vWl4Z9r7PVuwmS8= 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 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_40,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Message-ID: <53E39BAD.3010004@redhat.com> Date: Thu, 07 Aug 2014 09:30:53 -0600 From: Eric Blake User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.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> <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> In-Reply-To: <53E3685B.8050508@cornell.edu> OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nJoRgDUBFLa9jl9NIC5jFo6j1pVg15j9i" X-IsSubscribed: yes --nJoRgDUBFLa9jl9NIC5jFo6j1pVg15j9i Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 08/07/2014 05:51 AM, Ken Brown wrote: >=20 > 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=3D858 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --nJoRgDUBFLa9jl9NIC5jFo6j1pVg15j9i Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJT45uuAAoJEKeha0olJ0NqdcYH+wXvpKiswxupooPwbKui84Kd oOV1nsXmEPF6S9S7nuGLUQDLx/vEAR4wFKQL1J2P7vEIQp3Uc817NuWrnsqCDnxd gs5n0Hrlt1CuFfvNynvbByrRlHATsj5O4mnFN2nl4Bs1PUIAPSj9SUoMIu0364Ws ECR6dTIEkiNSv1F5eu4pG0NHJSuSmItQIxozApSANgSfA1zCX3sKKBrVPX5RLs/t 3TzqCiSgnQc7DroUxQDOy25qI6cIhgeggnfixcR6q9xEd9Hlw4kYTvQ1TdOFd7Gi /K0+NCdB5V5zSkA6d1J572iBu5TgwNvLS17qdbkSXJa52NkPIkj6BqeAHfWwVQA= =sxae -----END PGP SIGNATURE----- --nJoRgDUBFLa9jl9NIC5jFo6j1pVg15j9i--