* Deadlock when pressing Ctrl-C at startup of a native console application
@ 2022-04-15 18:09 Alexey Izbyshev
2022-04-16 9:16 ` Takashi Yano
0 siblings, 1 reply; 4+ messages in thread
From: Alexey Izbyshev @ 2022-04-15 18:09 UTC (permalink / raw)
To: cygwin
Hi,
I've discovered that pressing Ctrl-C in a Cygwin ssh session running the
following command can cause a deadlock:
$ while python -c ''; do :; done
The exact native application doesn't matter here, e.g. "ping -n 1
localhost >/dev/null" instead of "python -c ''" also "works".
The deadlock is most easily triggered when CPU is fully loaded. It takes
no more than 20 tries on my machine to hit it (and when I first saw it,
it was on the first try).
When the deadlock is triggered, there are conhost.exe and
cygwin-console-helper.exe processes, but there is no python.
The exact process tree varies depending on Cygwin version. With the
vanilla 3.3.4 (the root is bash spawned by sshd):
bash---bash-+-conhost.exe
`-cygwin-console-helper.exe
With 20220301 snapshot
(https://cygwin.com/snapshots/x86/cygwin1-20220301.dll.xz), I get one of
the two following trees with an extra conhost.exe process:
bash---bash-+-conhost.exe
|-conhost.exe
`-cygwin-console-helper.exe
or
bash---bash-+-conhost.exe
| `-cygwin-console-helper.exe
`-conhost.exe
I was testing with 32-bit Cygwin on x64 Windows 10 21H2.
Thanks,
Alexey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Deadlock when pressing Ctrl-C at startup of a native console application
2022-04-15 18:09 Deadlock when pressing Ctrl-C at startup of a native console application Alexey Izbyshev
@ 2022-04-16 9:16 ` Takashi Yano
2022-04-18 12:48 ` Takashi Yano
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Yano @ 2022-04-16 9:16 UTC (permalink / raw)
To: cygwin; +Cc: Alexey Izbyshev
On Fri, 15 Apr 2022 21:09:05 +0300
Alexey Izbyshev wrote:
> Hi,
>
> I've discovered that pressing Ctrl-C in a Cygwin ssh session running the
> following command can cause a deadlock:
>
> $ while python -c ''; do :; done
>
> The exact native application doesn't matter here, e.g. "ping -n 1
> localhost >/dev/null" instead of "python -c ''" also "works".
>
> The deadlock is most easily triggered when CPU is fully loaded. It takes
> no more than 20 tries on my machine to hit it (and when I first saw it,
> it was on the first try).
>
> When the deadlock is triggered, there are conhost.exe and
> cygwin-console-helper.exe processes, but there is no python.
>
> The exact process tree varies depending on Cygwin version. With the
> vanilla 3.3.4 (the root is bash spawned by sshd):
>
> bash---bash-+-conhost.exe
> `-cygwin-console-helper.exe
>
> With 20220301 snapshot
> (https://cygwin.com/snapshots/x86/cygwin1-20220301.dll.xz), I get one of
> the two following trees with an extra conhost.exe process:
>
> bash---bash-+-conhost.exe
> |-conhost.exe
> `-cygwin-console-helper.exe
>
> or
>
> bash---bash-+-conhost.exe
> | `-cygwin-console-helper.exe
> `-conhost.exe
>
> I was testing with 32-bit Cygwin on x64 Windows 10 21H2.
Thanks for the report. I could reproduce the issue.
I also found the current git master does not have this issue,
while cygwin-3_3-branch does.
Now I am identifying which patch solved the issue.
One is obviously:
https://cygwin.com/pipermail/cygwin-patches/2022q2/011870.html
however, this was applied also for cygwin-3_3-branch. Therefore,
another patch also should affect this issue.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Deadlock when pressing Ctrl-C at startup of a native console application
2022-04-16 9:16 ` Takashi Yano
@ 2022-04-18 12:48 ` Takashi Yano
2022-04-18 15:07 ` Alexey Izbyshev
0 siblings, 1 reply; 4+ messages in thread
From: Takashi Yano @ 2022-04-18 12:48 UTC (permalink / raw)
To: cygwin; +Cc: Alexey Izbyshev
On Sat, 16 Apr 2022 18:16:50 +0900
Takashi Yano wrote:
> On Fri, 15 Apr 2022 21:09:05 +0300
> Alexey Izbyshev wrote:
> > Hi,
> >
> > I've discovered that pressing Ctrl-C in a Cygwin ssh session running the
> > following command can cause a deadlock:
> >
> > $ while python -c ''; do :; done
> >
> > The exact native application doesn't matter here, e.g. "ping -n 1
> > localhost >/dev/null" instead of "python -c ''" also "works".
> >
> > The deadlock is most easily triggered when CPU is fully loaded. It takes
> > no more than 20 tries on my machine to hit it (and when I first saw it,
> > it was on the first try).
> >
> > When the deadlock is triggered, there are conhost.exe and
> > cygwin-console-helper.exe processes, but there is no python.
> >
> > The exact process tree varies depending on Cygwin version. With the
> > vanilla 3.3.4 (the root is bash spawned by sshd):
> >
> > bash---bash-+-conhost.exe
> > `-cygwin-console-helper.exe
> >
> > With 20220301 snapshot
> > (https://cygwin.com/snapshots/x86/cygwin1-20220301.dll.xz), I get one of
> > the two following trees with an extra conhost.exe process:
> >
> > bash---bash-+-conhost.exe
> > |-conhost.exe
> > `-cygwin-console-helper.exe
> >
> > or
> >
> > bash---bash-+-conhost.exe
> > | `-cygwin-console-helper.exe
> > `-conhost.exe
> >
> > I was testing with 32-bit Cygwin on x64 Windows 10 21H2.
>
> Thanks for the report. I could reproduce the issue.
> I also found the current git master does not have this issue,
> while cygwin-3_3-branch does.
>
> Now I am identifying which patch solved the issue.
> One is obviously:
> https://cygwin.com/pipermail/cygwin-patches/2022q2/011870.html
> however, this was applied also for cygwin-3_3-branch. Therefore,
> another patch also should affect this issue.
I identified the cause and applied a workaround patch.
The countermeasure version is available at:
https://tyan0.yr32.net/cygwin/x86/test/cygwin1-20220418.dll.xz
https://tyan0.yr32.net/cygwin/x86_64/test/cygwin1-20220418.dll.xz
Could you please test?
--
Takashi Yano <takashi.yano@nifty.ne.jp>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Deadlock when pressing Ctrl-C at startup of a native console application
2022-04-18 12:48 ` Takashi Yano
@ 2022-04-18 15:07 ` Alexey Izbyshev
0 siblings, 0 replies; 4+ messages in thread
From: Alexey Izbyshev @ 2022-04-18 15:07 UTC (permalink / raw)
To: Takashi Yano; +Cc: cygwin
On 2022-04-18 15:48, Takashi Yano wrote:
> On Sat, 16 Apr 2022 18:16:50 +0900
> Takashi Yano wrote:
>> On Fri, 15 Apr 2022 21:09:05 +0300
>> Alexey Izbyshev wrote:
>> > Hi,
>> >
>> > I've discovered that pressing Ctrl-C in a Cygwin ssh session running the
>> > following command can cause a deadlock:
>> >
>> > $ while python -c ''; do :; done
>> >
>> > The exact native application doesn't matter here, e.g. "ping -n 1
>> > localhost >/dev/null" instead of "python -c ''" also "works".
>> >
>> > The deadlock is most easily triggered when CPU is fully loaded. It takes
>> > no more than 20 tries on my machine to hit it (and when I first saw it,
>> > it was on the first try).
>> >
>> > When the deadlock is triggered, there are conhost.exe and
>> > cygwin-console-helper.exe processes, but there is no python.
>> >
>> > The exact process tree varies depending on Cygwin version. With the
>> > vanilla 3.3.4 (the root is bash spawned by sshd):
>> >
>> > bash---bash-+-conhost.exe
>> > `-cygwin-console-helper.exe
>> >
>> > With 20220301 snapshot
>> > (https://cygwin.com/snapshots/x86/cygwin1-20220301.dll.xz), I get one of
>> > the two following trees with an extra conhost.exe process:
>> >
>> > bash---bash-+-conhost.exe
>> > |-conhost.exe
>> > `-cygwin-console-helper.exe
>> >
>> > or
>> >
>> > bash---bash-+-conhost.exe
>> > | `-cygwin-console-helper.exe
>> > `-conhost.exe
>> >
>> > I was testing with 32-bit Cygwin on x64 Windows 10 21H2.
>>
>> Thanks for the report. I could reproduce the issue.
>> I also found the current git master does not have this issue,
>> while cygwin-3_3-branch does.
>>
>> Now I am identifying which patch solved the issue.
>> One is obviously:
>> https://cygwin.com/pipermail/cygwin-patches/2022q2/011870.html
>> however, this was applied also for cygwin-3_3-branch. Therefore,
>> another patch also should affect this issue.
>
> I identified the cause and applied a workaround patch.
> The countermeasure version is available at:
> https://tyan0.yr32.net/cygwin/x86/test/cygwin1-20220418.dll.xz
> https://tyan0.yr32.net/cygwin/x86_64/test/cygwin1-20220418.dll.xz
>
> Could you please test?
I've tested the 32-bit version, and Ctrl-C in my original test works as
expected (no deadlock or other issues after multiple tries). Thank you
for the fix!
Alexey
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-18 15:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-15 18:09 Deadlock when pressing Ctrl-C at startup of a native console application Alexey Izbyshev
2022-04-16 9:16 ` Takashi Yano
2022-04-18 12:48 ` Takashi Yano
2022-04-18 15:07 ` Alexey Izbyshev
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).