cygrunsrv + sshd + rsync = 20 times too slow -- throttled?
Jon Turney
jon.turney@dronecode.org.uk
Sat Sep 18 14:11:01 GMT 2021
On 18/09/2021 12:35, Takashi Yano wrote:
> On Sat, 18 Sep 2021 07:12:56 -0400
> Ken Brown wrote:
>>> 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
Oops. Somehow I missed the conclusion in that thread.
>>> 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();
>>
Thanks for the patch!
>> This may be unnecessarily drastic, given the analysis in my message cited above.
>
> It seems resetting handler only for SIGPIPE is enough according to
> the message you posted two years ago. Thanks.
I've applied Takashi-san's patch as is, and rebuilt the xwin-xdg-menu
package.
I think NSIG is sufficiently small that it's worth doing this for all
signals, just in case we ever ignore some other signal.
I probably need to audit that code more carefully for anything else it's
leaking into the child that it shouldn't be.
More information about the Cygwin-developers
mailing list