public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Alexey Izbyshev <izbyshev@ispras.ru>
To: Takashi Yano <takashi.yano@nifty.ne.jp>
Cc: cygwin@cygwin.com
Subject: Re: Deadlock of the process tree when running make
Date: Wed, 13 Apr 2022 19:48:04 +0300	[thread overview]
Message-ID: <1bdd5ac77277343fbff9b560fa98b15e@ispras.ru> (raw)
In-Reply-To: <ab8ded5fb5dad09dc2aebe5b49aa7dac@ispras.ru>

On 2022-04-11 13:10, Alexey Izbyshev wrote:
> On 2022-04-11 11:35, Takashi Yano wrote:
>> On Sun, 10 Apr 2022 23:49:29 +0300
>> A countermeasure version is available at the following location:
>> https://tyan0.yr32.net/cygwin/x86/test/cygwin1-20220411.dll.xz
>> https://tyan0.yr32.net/cygwin/x86_64/test/cygwin1-20220411.dll.xz
>> 
>> Could you please test? To keep the hanging tree, please install
>> cygwin another directory, and replace cygwin1.dll with the
>> countermeasure version.
>> 
> Thank you for providing the binaries! I've started testing in a
> separate cygwin installation on the same machine, as you suggested.
> The hang previously took many hours to reproduce, so I'll keep tests
> running for a while and then report back.
> 
The good news is that the tests have been running for two days so far 
without any cygwin-related issues, so the patched version doesn't seem 
to introduce new issues.

The bad news is my theory about the suspicious "Unnamed file: 
\FileSystem\Npfs" in the hanging bash.exe being a leak seems to be 
wrong. I've closed that handle, but conhost.exe hasn't unblocked. All of 
its threads are doing the same things as before:

1. Tries to enter a critical section. (Task Manager claims it waits for
thread 4, so probably the latter owns it).
2. ReadFile("pty1-from-master-nat" named pipe)
3. Waits for an anonymous event.
4. Waits on a handle for "\Device\ConDrv" (in DeviceIoControl()).
5. Blocked in GetMessageW().

I've created a model situation with bash.exe stopped at a breakpoint in 
ClosePseudoConsole() at another machine again, and it seems that the 
last time I missed that bash.exe contains *two* handles for (different) 
"Unnamed file: \FileSystem\Npfs" here too, so it seems to be normal.

What's probably not normal is the behavior of the hanging conhost.exe. 
I've compared the points where conhost.exe is blocked, and all but one 
threads in the model case are doing the same things as in the hanging 
case, but the remaining thread is blocked in 
ReadFile("\Device\NamedPipe\") (i.e. the read end of "hWritePipe" of 
pcon) instead of trying to enter a critical section like thread 1 above. 
So now I'm starting to doubt that it's a cygwin bug and not some 
conhost.exe bug.

I'll try to poke around the hanging conhost.exe some more, and also may 
be will try to create a faster reproducer.

Thanks for your help so far,
Alexey

  reply	other threads:[~2022-04-13 16:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 21:53 Alexey Izbyshev
2022-04-07 23:54 ` Brian Inglis
2022-04-08  8:42   ` Alexey Izbyshev
2022-04-08 17:04     ` Brian Inglis
2022-04-11 13:27       ` Alexey Izbyshev
2022-04-09 10:17 ` Takashi Yano
2022-04-09 11:00   ` Alexey Izbyshev
2022-04-09 11:02     ` Alexey Izbyshev
2022-04-09 11:46       ` Takashi Yano
2022-04-09 16:07         ` Alexey Izbyshev
2022-04-09 16:57           ` Takashi Yano
2022-04-09 17:23             ` Alexey Izbyshev
2022-04-09 17:54               ` Takashi Yano
2022-04-09 19:35                 ` Alexey Izbyshev
2022-04-09 20:26                   ` Alexey Izbyshev
2022-04-10  7:34                     ` Takashi Yano
2022-04-10 12:13                       ` Alexey Izbyshev
2022-04-10 20:49                         ` Alexey Izbyshev
2022-04-11  8:35                           ` Takashi Yano
2022-04-11 10:10                             ` Alexey Izbyshev
2022-04-13 16:48                               ` Alexey Izbyshev [this message]
2022-04-13 17:22                                 ` Takashi Yano
2022-04-13 17:27                                   ` Alexey Izbyshev
2022-04-13 23:17                                 ` Alexey Izbyshev
2022-04-16  9:39                                   ` Takashi Yano
2022-04-16 13:21                                     ` Alexey Izbyshev
2022-04-27 11:22                                       ` Takashi Yano
2022-04-27 12:19                                         ` Alexey Izbyshev
2022-04-11  5:23               ` Jeremy Drake
2022-04-11  8:36                 ` Takashi Yano
2022-04-11 15:28                 ` Alexey Izbyshev
2022-04-11 17:02                   ` Jeremy Drake

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=1bdd5ac77277343fbff9b560fa98b15e@ispras.ru \
    --to=izbyshev@ispras.ru \
    --cc=cygwin@cygwin.com \
    --cc=takashi.yano@nifty.ne.jp \
    /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).