cygrunsrv + sshd + rsync = 20 times too slow -- throttled?
Ken Brown
kbrown@cornell.edu
Sat Sep 18 11:12:56 GMT 2021
On 9/18/2021 4:03 AM, Takashi Yano wrote:
> If xterm is started from xwin-xdg-menu, minimized test case
> (/bin/echo A; /bin/echo B) | head -1
> also causes the error:
> /bin/echo: write error: Broken pipe
>
> Even in mintty, this error occurs if it is started from
> xwin-xdg-menu.
>
> I also confirmed that this also happen with cygwin 3.2.0.
>
> However this does not happen if xterm is started from
> mintty window by 'xterm -display :0'.
>
> So, this is not a regression in cygwin 3.3.0 [TEST].
> In other words, the change of pipe implementation is not
> the culprit.
> It seems that SIGPIPE is handled differently. I guess
> SIGPIPE is handled by SIG_IGN if the terminal started
> from xwin-xdg-menu, otherwize, it is handled by SIG_DFL.
Yes, I remember now that the same issue came up a couple years ago:
https://cygwin.com/pipermail/cygwin/2019-August/242060.html
> Ah, the following patch for xwin-xdg-menu may be the
> right thing.
>
> --- execute.c.orig 2021-06-23 23:59:37.000000000 +0900
> +++ execute.c 2021-09-18 16:53:52.144248600 +0900
> @@ -76,6 +76,7 @@
> {
> struct rlimit rl;
> unsigned int fd;
> + int sig;
>
> /* dup write end of pipes onto stderr and stdout */
> close(STDOUT_FILENO);
> @@ -89,6 +90,10 @@
> for (fd = STDERR_FILENO + 1; fd < rl.rlim_cur; fd++)
> close(fd);
>
> + /* Set all signal handlers to SIG_DFL. */
> + for (sig = 1; sig < NSIG; sig++)
> + signal(sig, SIG_DFL);
> +
> /* Disassociate any TTYs */
> setsid();
This may be unnecessarily drastic, given the analysis in my message cited above.
Ken
More information about the Cygwin-developers
mailing list