public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: cygwin@cygwin.com
Subject: Re: (call-process ...) hangs in emacs
Date: Mon, 04 Aug 2014 13:34:00 -0000	[thread overview]
Message-ID: <53DF8BDC.8090104@cornell.edu> (raw)
In-Reply-To: <20140804080034.GA2578@calimero.vinschen.de>

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:
>>> On Aug  1 14:17, Peter Hull wrote:
>>>> On Fri, Aug 1, 2014 at 1:50 PM, Angelo Graziosi
>>>> <angelo.graziosi@alice.it> wrote:
>>>>> Since I upgraded to Cygwin-1.7.31*, I see similar issue in building Emacs
>>>>> trunk (--with-w32 build)... The build always hangs in compiling some .el
>>>>> file. CTRL-C does not work and I have to search the running processes with
>>>>> "ps" and kill them with 'kill -9'. Downgrading to 1.7.30, things work
>>>>> better. Now I am using 1.7.30...
>>>> By better, do you mean 'perfectly'? It seems like it might be a little
>>>> bit intermittent, from the reports I have seen.
>>>>
>>>> It's easy enough to do a cvs rdiff between the releases if 1.7.30 is
>>>> known to be good - I am happy to help but I am unfamiliar with the
>>>> code so I don't know where to start looking...
>>>
>>> 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 output)
>> 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 call
>> to fork() never returns.  I also tried running it under strace, but again
>> 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 snapshot,
>> is that the current directory is displayed, followed by the exit code of 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?

emacs does some bookkeeping and then calls vfork.  It does not create a 
new 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 build of emacs but not in the Linux build.)

I did think about trying to create an STC, but I'm stymied because the 
problem depends so strongly on how emacs is run:

  - If emacs is run interactively, the problem only occurs with 
emacs-nox, not with emacs-X11 or emacs-w32.

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

I can't think of any way to capture these peculiarities in an STC.

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

  reply	other threads:[~2014-08-04 13:34 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01 12:51 Angelo Graziosi
2014-08-01 13:17 ` Peter Hull
2014-08-01 13:32   ` Corinna Vinschen
2014-08-04  1:03     ` Ken Brown
2014-08-04  8:00       ` Corinna Vinschen
2014-08-04 13:34         ` Ken Brown [this message]
2014-08-04 13:45           ` Corinna Vinschen
2014-08-05 12:21             ` Ken Brown
2014-08-05 13:33               ` Peter Hull
2014-08-05 13:59                 ` Peter Hull
2014-08-05 13:58               ` Corinna Vinschen
2014-08-05 17:55                 ` Ken Brown
2014-08-05 18:40                   ` Corinna Vinschen
2014-08-07 11:52                     ` Ken Brown
2014-08-07 12:51                       ` Corinna Vinschen
2014-08-07 18:54                         ` Ken Brown
2014-08-07 15:30                       ` Eric Blake
2014-08-07 18:54                         ` Ken Brown
2014-08-07 21:42                           ` Eric Blake
2014-08-08 13:27                             ` Ken Brown
2014-08-08 15:39                               ` Peter Hull
2014-08-09  1:38                                 ` Ken Brown
2014-08-18 12:28                               ` Ken Brown
2014-08-18 14:58                                 ` Peter Hull
2014-08-18 15:03                                   ` Larry Hall (Cygwin)
2014-08-25 19:00                                 ` Ken Brown
2014-08-26  9:13                                   ` Peter Hull
2014-08-26 18:55                                   ` Achim Gratz
2014-08-26 22:13                                     ` Ken Brown
2014-08-27  8:42                                       ` Corinna Vinschen
2014-08-27 12:53                                         ` Ken Brown
2014-08-27 13:47                                           ` Corinna Vinschen
2014-08-27 14:40                                             ` Eric Blake
2014-08-27 17:15                                               ` Ken Brown
2014-08-27 15:15                                           ` Achim Gratz
2014-08-28  7:25                                             ` Achim Gratz
2014-08-28  9:55                                               ` Corinna Vinschen
2014-08-28 13:18                                                 ` Corinna Vinschen
2014-08-28 15:04                                                   ` Achim Gratz
2014-08-28 15:10                                                     ` Corinna Vinschen
2014-08-28 15:27                                                   ` Achim Gratz
2014-08-29  9:59                                                     ` Achim Gratz
2014-08-29 11:09                                                       ` Corinna Vinschen
2014-08-29 18:08                                                         ` Ken Brown
2014-08-29 19:23                                                           ` Achim Gratz
2014-08-29 19:36                                                             ` Ken Brown
2014-08-29 20:00                                                               ` Achim Gratz
2014-08-29 21:38                                                                 ` Ken Brown
2014-08-29 20:05                                                               ` Andrey Repin
2014-08-29 21:43                                                               ` Corinna Vinschen
2014-08-29 23:35                                                                 ` Andrey Repin
2014-09-01 11:47                                                                   ` Corinna Vinschen
2014-09-01 11:57                                                       ` Corinna Vinschen
2014-09-01 17:38                                                         ` Achim Gratz
2014-09-02  8:32                                                           ` Corinna Vinschen
2014-09-02 17:29                                                             ` Achim Gratz
2014-09-02 19:19                                                               ` Corinna Vinschen
2014-09-02 19:42                                                                 ` Achim Gratz
2014-09-02 20:09                                                                   ` Corinna Vinschen
2014-09-02 20:23                                                                     ` Achim Gratz
2014-09-03 13:04                                                                       ` Corinna Vinschen
2014-09-03 17:59                                                                         ` Achim Gratz
2014-08-28 10:34                                             ` Eric Blake
2014-08-27 21:05                                         ` Andrey Repin
2014-08-28 10:01                                           ` Corinna Vinschen
2014-08-28 13:35                                             ` Andrey Repin
2014-08-28 14:10                                               ` Corinna Vinschen
2014-08-28 17:05                                                 ` ACL behavior in Cygwin // " Andrey Repin
2014-08-28 18:29                                                   ` Achim Gratz
2014-08-29  8:29                                                   ` Corinna Vinschen
2014-08-28 18:38                                                 ` Achim Gratz
2014-08-28 19:50                                                   ` Andrey Repin
2014-08-06  2:30                   ` Katsumi Yamaoka
2014-08-06  8:48                     ` Corinna Vinschen
2014-08-06 23:41                       ` Katsumi Yamaoka
2014-08-07  0:35                         ` Andrey Repin
2014-08-04  8:05       ` Peter Hull
2014-08-04 13:36         ` Ken Brown
  -- strict thread matches above, loose matches on Subject: below --
2014-08-06  0:15 Angelo Graziosi
2014-07-31 14:51 Peter Hull
2014-07-31 17:35 ` Ken Brown
2014-08-01  7:36 ` Peter Hull
2014-08-01 10:22 ` Katsumi Yamaoka
2014-08-01 11:33   ` Peter Hull

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53DF8BDC.8090104@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).