cygwin application hangs on closing console
Takashi Yano
takashi.yano@nifty.ne.jp
Wed Jul 3 14:09:16 GMT 2024
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.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
More information about the Cygwin
mailing list