delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/08/04/09:45:46

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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=glIfSzsLvA3Q+ysuM+pfXFp3HS5A9QeFLBSu2R38wlx8YVuAr23Qh
lHvynj5z7XFlW4RaBTs2vZGHDKK/gAW3XyTPpUtekaEpyiSiwuHdcXkceiii+dOP
JrCEBY/NvqETSNURQOSyldAso9EwlzjoCqiPJebNLM6Hwn3fUrUk8E=
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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=mvHzBBdFGXB6+sk4qGFBSxEwXWw=; b=EbO007Co+pCE/ocbzdXM4iO8SIka
JJv6DZiKtw9ZZ/1Z8vMExPzsp4NnPctbhiqY3V5xQZQGFjnjcyt3zCblHboc5mzh
szt39lc/NmQF7sX6mF/JSArJ+SCcc2p0o9Pivhomwy3XXuXruvXYhM8JbTPv8tvJ
Bca38gsnXPn/4Yg=
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=-4.6 required=5.0 tests=AWL,BAYES_50 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Mon, 4 Aug 2014 15:45:26 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: (call-process ...) hangs in emacs
Message-ID: <20140804134526.GK2578@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
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>
MIME-Version: 1.0
In-Reply-To: <53DF8BDC.8090104@cornell.edu>
User-Agent: Mutt/1.5.23 (2014-03-12)

--sl5MdczEF/OU2Miu
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Aug  4 09:34, Ken Brown wrote:
> On 8/4/2014 4:00 AM, Corinna Vinschen wrote:
> >On Aug  3 21:02, Ken Brown wrote:
> >>On 8/1/2014 9:32 AM, Corinna Vinschen wrote:
> >>>It could be a problem with the new default pthread mutexes being
> >>>NORMAL, rather then ERRORCHECK mutexes.
> >>
> >>That does seem to be the problem, since I can reproduce the bug starting
> >>with the 2014-07-14 snapshot.  More precisely, I can reproduce it using
> >>emacs-nox (which is what the OP was using according to his cygcheck out=
put)
> >>but not using emacs-X11 or emacs-w32.
> >>
> >>I tried running emacs under gdb with a breakpoint at call_process, but =
all I
> >>could see from that is that emacs tries to fork a subprocess, but the c=
all
> >>to fork() never returns.  I also tried running it under strace, but aga=
in
> >>all I can see is that fork() is called and then everything seems to be =
at a
> >>standstill.
> >>
> >>Corinna, if you want to take a look, here's the precise recipe:
> >>
> >>1. emacs-nox -Q [This should start emacs and put you in the *scratch*
> >>buffer.]
> >>
> >>2. Enter the following text into the buffer:
> >>
> >>   (call-process "pwd" nil t)
> >>
> >>3. Position the cursor at the end of the line and type Ctrl-j.
> >>
> >>What should happen, and what does happen prior to the 2014-07-14 snapsh=
ot,
> >>is that the current directory is displayed, followed by the exit code o=
f 0.
> >>What happens instead is that emacs appears to hang.
> >
> >How does emacs start a process?  Does it create a thread and then
> >forks and execs from the thread?  Does it use its own pthread_mutex
> >to control the job?  Is there a chance to create an STC of this
> >process?
>=20
> emacs does some bookkeeping and then calls vfork.  It does not create a n=
ew
> thread, nor does it create a pthread_mutex.  The only pthread_mutexes
> created anywhere in the emacs source code are in its implementation of
> malloc and friends, not in anything directly related to controlling
> subprocesses.  (FWIW, this malloc implementation is used in the Cygwin bu=
ild
> of emacs but not in the Linux build.)

Can you take a close look here?  This malloc will be used by Cygwin
as well if it's implemented in the usual way and...

> I did think about trying to create an STC, but I'm stymied because the
> problem depends so strongly on how emacs is run:
>=20
>  - If emacs is run interactively, the problem only occurs with emacs-nox,
> not with emacs-X11 or emacs-w32.
>=20
>  - If emacs is run non-interactively (i.e., in batch mode), the problem
> occurs with emacs-w32 and emacs-X11 too, as Angelo and Katsumi pointed out
> earlier in the thread.
>=20
> I can't think of any way to capture these peculiarities in an STC.

...this, and the fact that fork/exec (vfork =3D=3D fork on Cygwin) still
works nicely in other scenarios points to some problem with the usage of
pthread_mutexes in the application may be the culprit.

For instance, is it possible that emacs expects the pthread_mutexes
in malloc to be ERRORCHECK mutexes?  What if you explicitely set
them to ERRORCHECK at creation time?


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--sl5MdczEF/OU2Miu
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJT3452AAoJEPU2Bp2uRE+gpEQP/iAUyVtjAUEyRIBep8Waf/Ft
cwETUWQ2s0MI5n2zn7NrtOEul0/ek4JaSdJpiKNMWQUiaOtWfB1fovnUiCWSg6U0
w7s1WLPwNRIhvJBj/1/Jr9eCBxUhfp38om2hF8knGRTUwPS99kAuZmee1VC/urZX
Q7NSJaXodgCHDf7hgp6bbTK+PsDwmCNU77ke1d5AM4YrbuZld2YfQC6IFP/TzDCA
mQOC7x5MVv9xTGktMt0ddZtKhX1DfLu911gFSmU93G6B66qr5vjWER7TC5CIRpPB
YY3OJje3vSHqItHmMJZWc6aWMv7FH04Mmt5rWoUO+7XVWKmbKlK2MBmvQhcV2nrx
Yar+r1Elc6BsJ8KpQgwLtqsO490ku5VTNAOJPIteyFx1ExhnkJDnKr5qjoUMU4NR
tOTUZmlugpOF199XdXeNDJkHcuq1m4j3X4bHuzB4mkAeOknZL92CweU1NiTiRXtU
5XiEmxoQsgJ4bBoTd/SCkYRIPiSdHVe7NZ7yNppcvzSveGZmJdptTVV/SaerSezy
ZO7Um9diXOlG5kVXAhRaJ1oM9CoybxL43b16DFznh4uzTYGxe1s39iss2zZpSAxl
nuDxX7kKa47/YGwYKrTAL10lQ583V0qafSUFgR7M5pTAwSyoWjgLCVGEvL0ITo1I
cR+yK/g/TOXpeESaWHDN
=lYlf
-----END PGP SIGNATURE-----

--sl5MdczEF/OU2Miu--

- Raw text -


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