cygwin application hangs on closing console
Johannes Khoshnazar-Thoma
johannes@johannesthoma.com
Wed Jul 3 14:16:20 GMT 2024
Hi Takashi Yano,
Am 03.07.24 um 16:09 schrieb Takashi Yano:
> On Tue, 2 Jul 2024 19:45:15 +0900
> Takashi Yano wrote:
>> On Mon, 1 Jul 2024 22:20:20 +0900
>> Takashi Yano wrote:
>>> On Mon, 1 Jul 2024 13:47:56 +0200
>>> Johannes Khoshnazar-Thoma wrote:
>>>> Note that the hang does not happen when just running cygwin
>>>> applications via terminal windows (like cmd, powershell and
>>>> MinTTY). It triggers however when a cygwin application is
>>>> run both as a service (I think as SYSTEM account, but I
>>>> can ask again) and from a terminal window.
>>>
>>> Service process usually does not have console. So I think
>>> fhandler_console::open()/close() are not called.
>>>
>>> Do you allocate console for your service process somehow?
>>
>> I could reproduce your problem by allocating console for
>> service process.
>>
>> I'll look into the problem. Thanks.
>
> The cause has been clear. As a result, your points and patches
> were very spot on.
>
> get_minor() retuns unique number for each console in a session,
> but not unique accross sessions. I looked over that point.
>
> This is because EnumWindows(), which is used to look for console
> windows, cannot enumerate windows accross sessions. This causes
> conflict on shared name between sessions (e.g. sessions of different
> users, different services, a service and a user session, etc.).
>
> I'll use GetConsoleWindow() instead of get_minor() to create
> shared name.
>
> Thank you very much for finding this problem.
> I'll submit a patch for that and push it shortly.
>
Thank you very much that is awesome news. I will build and
forward a package to our client to verify that this issue
is fixed now as soon as the patch is pushed.
Thanks again for your hard work on cygwin, it is hard to find
bugs in there because there are not that many ... :)
Best regards,
- Johannes
More information about the Cygwin
mailing list