delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 605A13858C32 |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1710067284; | |
bh=Iy+ik+50BU78igIRAO5ouUGg7dN+Ol8RvYN7UVCS/EU=; | |
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: | |
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: | |
From; | |
b=BQ8wFEPSLT8hwITqmq2aZ3CJpPzuAhnPTmwDHHy3vDeaTlugYaWqdhrgC636x5a8d | |
18X89dHQIByhaJKfHCJQ2kQ0ymNt1+V6jToCB673Rv9zEJ7uq4U1vJtRYNRmWt+3qt | |
Mfagi3tcoIg/S8AwaapUS9DOLtzFvFaQb/qtCJwQ= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DMARC-Filter: | OpenDMARC Filter v1.4.2 sourceware.org D30BB3858CD1 |
ARC-Filter: | OpenARC Filter v1.0.0 sourceware.org D30BB3858CD1 |
ARC-Seal: | i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710066871; cv=none; |
b=ShXjmWROCb940gABXvKPFrw27ep2li5TXKclpMeOryJ1Fv6zYlQdEP8C8fIZgTU2Qb/WrDuRLRHtxWM4EQ438kiDWU7KDi5lPRuI5t/REA5sdg8TPJPO7lJGV4tMVLdE/ci0HtbsKo7ogIhh/yzmcxwvdt/+yklx4g6Ps62rz3o= | |
ARC-Message-Signature: | i=1; a=rsa-sha256; d=sourceware.org; s=key; |
t=1710066871; c=relaxed/simple; | |
bh=JSilOrSq9WDdzxRBU9qZ1KMY48mdMDDPN7sxY9AEX4w=; | |
h=Date:From:To:Subject:Message-Id:Mime-Version; | |
b=PsERovnUhwzwhdrLyIq7ualGBD1Co4qgHVZI6NPeSxpY7Jeil6iwQOo+Pq2bqs5MgbPbc23yr+iM4OBlC4jg4fiIY4jZb0Icpte8oXNDmvGvQAGzn/f/RdB/wV2tsM1beGljMYAItnfi5EQj2+Zeyvu8QJQ3GBqLMWW3DSJqbp0= | |
ARC-Authentication-Results: | i=1; server2.sourceware.org |
Date: | Sun, 10 Mar 2024 19:34:26 +0900 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Non-Cygwin programs touching a pipe's read side makes the write |
side unselectable | |
Message-Id: | <20240310193426.bf692d19d1fe98fd88ea2401@nifty.ne.jp> |
In-Reply-To: | <20240310173853.80daa977727d150e01f7d437@nifty.ne.jp> |
References: | <65KX60jlLVixJi4klNmiJe651YqfGN6DnUua5NFmrcg1EFKw89L5S6ovU0FuiUn1323xcDnoEMR0IztckkJuDByCvNrkWUQqr3CilAgWAWc=@protonmail.com> |
<20240310173853 DOT 80daa977727d150e01f7d437 AT nifty DOT ne DOT jp> | |
X-Mailer: | Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) |
Mime-Version: | 1.0 |
X-Spam-Status: | No, score=-2.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, |
NICE_REPLY_A, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, | |
SPF_PASS, TXREP, | |
T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 | |
X-Spam-Checker-Version: | SpamAssassin 3.4.6 (2021-04-09) on |
server2.sourceware.org | |
X-BeenThere: | cygwin AT cygwin DOT com |
X-Mailman-Version: | 2.1.30 |
List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
List-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
From: | Takashi Yano via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp> |
Errors-To: | cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com |
Sender: | "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com> |
On Sun, 10 Mar 2024 17:38:53 +0900 Takashi Yano wrote: > On Sun, 10 Mar 2024 05:49:43 +0000 > wh wrote: > > Here's how to reproduce this behavior. > > > > In test3.pl: > > > > #!/usr/bin/perl > > my $wfds = ''; > > vec($wfds, fileno(STDOUT), 1) = 1; > > sleep 1; > > print STDERR "selecting\n"; > > select undef, $wfds, undef, undef; > > print STDERR "ready\n"; > > print "abc\n"; > > > > Then run: > > > > # curl is as shipped with Windows, /cygdrive/c/Windows/system32/curl > > ./test3.pl | (curl --version && cat) > > > > Expected result: > > > > curl 8.4.0 (Windows) libcurl/8.4.0 Schannel WinIDN > > ... > > selecting > > ready > > abc > > > > Actual result: > > > > curl 8.4.0 (Windows) libcurl/8.4.0 Schannel WinIDN > > ... > > selecting > > (hang) > > > > Using strace on perl, it ends with > > > > 95 332358 [main] perl 733 clock_nanosleep: clock_nanosleep (1.000000000) > > 1004437 1336795 [main] perl 733 clock_nanosleep: 0 = clock_nanosleep(1, 0, 1.000000000, 0.d) > > 247 1337042 [main] perl 733 time: 1710048216 = time(0x7FFFFCA00) > > 1010 1338052 [main] perl 733 fhandler_console::write: 0xA00051B10, 10 > > 822 1338874 [main] perl 733 fhandler_console::write: 10 = fhandler_console::write(...) > > 203 1339077 [main] perl 733 write: 10 = write(2, 0xA00051B10, 10) > > 254 1339331 [main] perl 733 pselect: pselect (8, 0x0, 0xA000330E0, 0x0, 0x0, 0x0) > > 207 1339538 [main] perl 733 pselect: to NULL, us -1 > > 490 1340028 [main] perl 733 dtable::select_write: fd 1 > > 191 1340219 [main] perl 733 select: sel.always_ready 0 > > --- Process 6888 (pid: 733) thread 784 created > > 859 1341078 [pipesel] perl 733 cygthread::stub: thread 'pipesel', id 0x310, stack_ptr 0x2BBCCB0 > > 192 1341270 [main] perl 733 select_stuff::wait: m 3, us 18446744073709551615, wmfo_timeout -1 > > 196 1341466 [pipesel] perl 733 SetThreadName: SetThreadDescription() failed. 00000000 10000000 > > > > Pipesel never comes back. > > > > Other info: > > > > - Replacing cat with tee (tee with no args is the same as cat) makes it work. tee reads in smaller chunks, while cat reads at the pipe buffer size. Comments in select.cc suggest this is important, but I don't understand it all. > > - Removing the curl makes it work > > - Using curl </dev/null to make curl not touch stdin makes it work > > - Using a Cygwin program instead of a non-Cygwin program e.g. id instead of curl makes it work > > - Removing the select confirms that nothing weird is breaking the pipe, and the "abc' shows up properly > > > > There was a report in MSYS2 https://github.com/msys2/msys2-runtime/issues/202 also about pipes to external programs, but there are some differences. In this scenario the non-Cygwin curl doesn't actually read anything from the pipe, and it should have exited before the select call. I tried a build of MSYS2 with their fix, and it still hangs in this way. > > Thanks for the report. I looked into this problem, and found the cause. > Let me consider how to fix that. I have submitted the patch for this issue. Now it is waiting for the review. Thanks. -- Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp> -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |