From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-06.nifty.com (conssluserg-06.nifty.com [210.131.2.91]) by sourceware.org (Postfix) with ESMTPS id 309BF3857823 for ; Tue, 22 Mar 2022 10:18:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 309BF3857823 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=nifty.ne.jp Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=nifty.ne.jp Received: from Express5800-S70 (ak036016.dynamic.ppp.asahi-net.or.jp [119.150.36.16]) (authenticated) by conssluserg-06.nifty.com with ESMTP id 22MAI74V015371; Tue, 22 Mar 2022 19:18:07 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com 22MAI74V015371 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1647944287; bh=tvqoPlmIXcdyfZubPBNZiQbu1BBr1TzC5LdxHEDc6T8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=f2y3aZuO9vBDG4LVlTtt9z/ncDXB9kQRkWYZIwabZNsVarrUKUKLtjbGfvHFJ1rry u5zkag2301Cnr6xDTEZ+N/h14L3rhik0WSp9fgYnR/EF2psoKEm6xfT49DkBec1ijV oEAIuaY2LxiMUmfACUma+wvyyzCfk5s9nr4YTRNE4zGaqyIcdJ6zxGfJ6A0Bo3P7Ku ZeDzq6stbtVhCjrYvUseixR6Gu49X4wGE+ka6ld253tQBh4sp0HB3xe52QXVI/5v0j ilMZyR2Nk22GraYWdJd+LYn8/DyatovORap6qWdSCpAsn4oTVdKbKpeB5De8+vnET+ Zv9/uSBasYqAA== X-Nifty-SrcIP: [119.150.36.16] Date: Tue, 22 Mar 2022 19:18:07 +0900 From: Takashi Yano To: cygwin@cygwin.com Cc: Jeremy Drake Subject: Re: pipe hang issue when running as SYSTEM Message-Id: <20220322191807.8348f074683c127b1723c5c2@nifty.ne.jp> In-Reply-To: References: X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Mar 2022 10:18:43 -0000 On Mon, 21 Mar 2022 11:45:57 -0700 (PDT) Jeremy Drake wrote: > 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). Thanks for the report. This is expected problem as mentioned in b531d6b commit message. However, I could not imagin the situation that the service has multiple writer for the pipe and one of them is a non-cygwin app. Question is: Does the docker invoke the command using SYSTEM account? Or is the processes in docker determined as running as a service? -- Takashi Yano