public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Jeremy Drake <cygwin@jdrake.com>
To: cygwin@cygwin.com
Subject: pipe hang issue when running as SYSTEM
Date: Mon, 21 Mar 2022 11:45:57 -0700 (PDT)	[thread overview]
Message-ID: <alpine.BSO.2.21.2203211141320.56460@resin.csoft.net> (raw)

This issue was reported to MSYS2 as a hang when trying to build libxml2 in
a Windows docker container.  Another user was able to come up with a
simple reproducer and a reasonable theory as to why it happens.  The msys2
issue is https://github.com/msys2/msys2-runtime/issues/77, and I will
quote the reproducer and analysis here:

I am having the same issue when building mingw. I managed to reduce the
issue to the following shell script:

#!/bin/sh
seq 1 99999 > big_file
eval '$(eval cmd.exe /c "type big_file" | : )'

When running as a normal user this completes immediately, but when run as
a system service it hangs forever. The issue appears to be that when
running under the SYSTEM account, the third sh process holds open the read
end of the pipe. Since cmd has too much output to write all at once, it
waits until the pipe's buffer has room to write more, but since sh isn't
actually reading from the pipe, this hangs forever. When running as a
normal user the read end of the pipe is not kept open, and so cmd.exe gets
an error when attempting to write and exits immediately.

My suspicion is that this is caused by f79a461 (which keeps the read end
of the pipe open) and b531d6b (which changes the behavior depending on
whether or not the program is running as a service).

             reply	other threads:[~2022-03-21 18:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21 18:45 Jeremy Drake [this message]
2022-03-22 10:18 ` Takashi Yano
2022-03-22 13:17   ` Takashi Yano
2022-03-25  3:42     ` Jeremy Drake
2022-03-25  5:42       ` Takashi Yano
2022-03-25  7:09         ` Jeremy Drake
2022-03-25 11:11           ` Takashi Yano
2022-03-25 17:01             ` Jeremy Drake
2022-03-29  9:11               ` Takashi Yano
2022-03-25  7:48         ` Roumen Petrov

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=alpine.BSO.2.21.2203211141320.56460@resin.csoft.net \
    --to=cygwin@jdrake.com \
    --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).