Re: cygwin application hangs on closing console

2024-06-03 Thread Johannes Khoshnazar-Thoma via Cygwin

Hi List,

We did more testing and it looks like the name of the event
that signals console master thread start and end is shared between
unrelated processes (it uses the console minor which is always (?)
0 when running from a powershell).

So since it is a two-state event (as opposed to a semaphore)
in theory the following can happen:

Process A   Process B
SetEvent(e)
SetEvent(e)
Waitforevent(e)
Waitforevent(e)

The second SetEvent does nothing. As a result the
later Waitforevent is stuck (which is what we observe).

So the question is: why should this event be used in
unrelated cygwin processes? Is there a technical reason
we don't understand (yet) for doing that (sharing the event).

We patched cygwin to use pseudo random event names (the
tm_usec field of gettimeofday()) and the stuckness vanished.
So unless there is a reason for sharing the event between
cygwin processes this patch should work:

From f2e2d125a21487579ecb9173406c6322ee4ecfeb Mon Sep 17 00:00:00 2001
From: Johannes Thoma 
Date: Wed, 29 May 2024 17:35:35 +
Subject: [PATCH] console: use pseudo random thread_sync_event name

---
 winsup/cygwin/fhandler/console.cc   | 9 +++--
 winsup/cygwin/local_includes/fhandler.h | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler/console.cc 
b/winsup/cygwin/fhandler/console.cc
index 1352482e9..d9c88d245 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -1895,7 +1895,12 @@ debug_printf("myself->pid %d con.owner %d\n", 
myself->pid, con.owner);
   if (GetModuleHandle ("ConEmuHk64.dll"))
hook_conemu_cygwin_connector ();
   char name[MAX_PATH];
-  shared_name (name, CONS_THREAD_SYNC, get_minor ());
+
+  struct timeval v;
+  gettimeofday(, NULL);
+  a_random_number = v.tv_usec;
+
+  shared_name (name, CONS_THREAD_SYNC, a_random_number);
   thread_sync_event = CreateEvent(NULL, FALSE, FALSE, name);
@@ -1983,7 +1988,7 @@ debug_printf("%s: 1\n", __func__);
  char name[MAX_PATH];
- shared_name (name, CONS_THREAD_SYNC, get_minor ());
+ shared_name (name, CONS_THREAD_SYNC, a_random_number);
  thread_sync_event = OpenEvent (MAXIMUM_ALLOWED, FALSE, name);
diff --git a/winsup/cygwin/local_includes/fhandler.h 
b/winsup/cygwin/local_includes/fhandler.h
index 978d3e514..132dc6477 100644
--- a/winsup/cygwin/local_includes/fhandler.h
+++ b/winsup/cygwin/local_includes/fhandler.h
@@ -2215,6 +2215,7 @@ public:
   };
   typedef cons_handle_set_t handle_set_t;
   HANDLE thread_sync_event;
+  int a_random_number;
 private:
   static const unsigned MAX_WRITE_CHARS;
   static console_state *shared_console_info[MAX_CONS_DEV + 1];
--
2.17.1


--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: cygwin application hangs on closing console

2024-05-15 Thread Johannes Khoshnazar-Thoma via Cygwin

Hi again,

Am 15.05.24 um 17:37 schrieb Johannes Khoshnazar-Thoma:

Hi again,

Am 23.04.24 um 12:26 schrieb Takashi Yano:

Thanks for the report. Could you please test cygwin1.dll 3.5.3-1
wihch is the latest cygwin release?



We retried the tests with cygwin1.dll 3.5.3-1 and it looks like
the issue is still there. Here's an excerpt from the gdb debug
session:


Sorry somehow the formatting got messed up I try again:

(gdb) info thread
  Id   Target Id Frame
* 1Thread 0x11cc 0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  2Thread 0x8ec  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  3Thread 0x55c  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  4Thread 0x131c 0x7ffe579d95f4 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  5Thread 0x9b8  0x7ffe579d95f4 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) thread 1
[Switching to thread 1 (Thread 0x11cc)]
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) bt
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffe54156d1f in WaitForSingleObjectEx () from 
C:\src\dlls-syms\KERNELBASE.dll\660F5EEC21e000\KERNELBASE.dll
#2  0x7ffe4a2033a0 in fhandler_console::close (this=0x89030) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/fhandler/console.cc:1914
#3  0x7ffe4a1f6ce7 in fhandler_base::close_with_arch (this=0x89030) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/fhandler/base.cc:1288
#4  0x7ffe4a26a4cd in init_cygheap::close_ctty (this=0x8) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/mm/cygheap.cc:135
#5  0x7ffe4a1c7c4e in close_all_files (norelease=norelease@entry=false) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/syscalls.cc:81
#6  0x7ffe4a146840 in do_exit (status=0) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1128
#7  0x7ffe4a1469f7 in _exit (n=) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1243
#8  0x7ffe4a2a4bb9 in exit (code=0) at 
/usr/src/debug/cygwin-3.5.3-1/newlib/libc/stdlib/exit.c:65
#9  0x7ffe4a1469e7 in cygwin_exit (n=5392) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1237
#10 0x7ffe4a14809a in dll_crt0_1 () at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1002
#11 0x7ffe4a145e08 in _cygtls::call2 (this=0x7ce00, func=0x7ffe4a146fb8 
, arg=0x0, buf=buf@entry=0x7cdf0) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:41
#12 0x7ffe4a145e86 in _cygtls::call (func=, arg=) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:28
#13 0x in ?? ()
(gdb) thread 2
[Switching to thread 2 (Thread 0x8ec)]
#0  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) bt
#0  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffe5415e704 in ReadFile () from 
C:\src\dlls-syms\KERNELBASE.dll\660F5EEC21e000\KERNELBASE.dll
#2  0x7ffe4a1bada6 in wait_sig () at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/sigproc.cc:1324
#3  0x7ffe4a144d5f in cygthread::callfunc (this=this@entry=0x7ffe4a335560 
, issimplestub=issimplestub@entry=false) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygthread.cc:48
#4  0x7ffe4a145270 in cygthread::stub (arg=arg@entry=0x7ffe4a335560 
) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygthread.cc:91
#5  0x7ffe4a145e08 in _cygtls::call2 (this=0xdbce00, func=0x7ffe4a1451ea 
, arg=0x7ffe4a335560 , buf=buf@entry=0xdbcd50) 
at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:41
#6  0x7ffe4a145e86 in _cygtls::call (func=, arg=) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:28
#7  0x7ffe84d4 in KERNEL32!BaseThreadInitThunk () from 
C:\src\dlls-syms\kernel32.dll\640993B0ad000\kernel32.dll
#8  0x7ffe57981791 in ntdll!RtlUserThreadStart () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#9  0x in ?? ()
(gdb) thread 3
[Switching to thread 3 (Thread 0x55c)]
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) bt
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffe54156d1f in WaitForSingleObjectEx () from 
C:\src\dlls-syms\KERNELBASE.dll\660F5EEC21e000\KERNELBASE.dll
#2  0x7ffe4a1452ab in cygthread::stub (arg=arg@entry=0x7ffe4a3355b8 
) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygthread.cc:112
#3  0x7ffe4a145e08 in _cygtls::call2 (this=0x2aece00, func=0x7ffe4a1451ea 
, arg=0x7ffe4a3355b8 

Re: cygwin application hangs on closing console

2024-05-15 Thread Johannes Khoshnazar-Thoma via Cygwin

Hi again,

Am 23.04.24 um 12:26 schrieb Takashi Yano:

Thanks for the report. Could you please test cygwin1.dll 3.5.3-1
wihch is the latest cygwin release?



We retried the tests with cygwin1.dll 3.5.3-1 and it looks like
the issue is still there. Here's an excerpt from the gdb debug
session:

(gdb) info thread
  Id   Target Id Frame  

 * 
1Thread 0x11cc 0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  2Thread 0x8ec  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  3Thread 0x55c  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll

 4Thread 0x131c 0x7ffe579d95f4 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  5Thread 0x9b8  0x7ffe579d95f4 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll 
  (gdb) thread 1
[Switching to thread 1 (Thread 0x11cc)] 

 #0 
 0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) bt
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffe54156d1f in WaitForSingleObjectEx () from 
C:\src\dlls-syms\KERNELBASE.dll\660F5EEC21e000\KERNELBASE.dll
#2  0x7ffe4a2033a0 in fhandler_console::close (this=0x89030) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/fhandler/console.cc:1914
#3  0x7ffe4a1f6ce7 in fhandler_base::close_with_arch (this=0x89030) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/fhandler/base.cc:1288
#4  0x7ffe4a26a4cd in init_cygheap::close_ctty (this=0x8) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/mm/cygheap.cc:135
#5  0x7ffe4a1c7c4e in close_all_files (norelease=norelease@entry=false) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/syscalls.cc:81
#6  0x7ffe4a146840 in do_exit (status=0) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1128
#7  0x7ffe4a1469f7 in _exit (n=) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1243
#8  0x7ffe4a2a4bb9 in exit (code=0) at 
/usr/src/debug/cygwin-3.5.3-1/newlib/libc/stdlib/exit.c:65
#9  0x7ffe4a1469e7 in cygwin_exit (n=5392) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1237
#10 0x7ffe4a14809a in dll_crt0_1 () at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1002
#11 0x7ffe4a145e08 in _cygtls::call2 (this=0x7ce00, func=0x7ffe4a146fb8 
, arg=0x0, buf=buf@entry=0x7cdf0) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:41
#12 0x7ffe4a145e86 in _cygtls::call (func=, arg=) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:28
#13 0x in ?? ()
(gdb) thread 2
[Switching to thread 2 (Thread 0x8ec)]
#0  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) bt
#0  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffe5415e704 in ReadFile () from 
C:\src\dlls-syms\KERNELBASE.dll\660F5EEC21e000\KERNELBASE.dll
#2  0x7ffe4a1bada6 in wait_sig () at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/sigproc.cc:1324
#3  0x7ffe4a144d5f in cygthread::callfunc (this=this@entry=0x7ffe4a335560 
, issimplestub=issimplestub@entry=false) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygthread.cc:48
#4  0x7ffe4a145270 in cygthread::stub (arg=arg@entry=0x7ffe4a335560 
) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygthread.cc:91
#5  0x7ffe4a145e08 in _cygtls::call2 (this=0xdbce00, func=0x7ffe4a1451ea 
, arg=0x7ffe4a335560 , buf=buf@entry=0xdbcd50) 
at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:41
#6  0x7ffe4a145e86 in _cygtls::call (func=, arg=) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:28
#7  0x7ffe84d4 in KERNEL32!BaseThreadInitThunk () from 
C:\src\dlls-syms\kernel32.dll\640993B0ad000\kernel32.dll
#8  0x7ffe57981791 in ntdll!RtlUserThreadStart () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#9  0x in ?? ()
(gdb) thread 3
[Switching to thread 3 (Thread 0x55c)]
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll

Re: cygwin application hangs on closing console

2024-04-23 Thread Johannes Khoshnazar-Thoma via Cygwin

Am 22.04.24 um 20:51 schrieb Takashi Yano:

On Mon, 22 Apr 2024 14:50:51 +0200
Johannes Khoshnazar-Thoma wrote:

Hi cygwin team :)

I have found something what may be a cygwin bug. Sometimes
(1 out of 1000 times) a drbdadm.exe process (which is part of WinDRBD's
user mode programs originally written for Linux) hangs for several
days on exiting (closing the console). I got a minidump and analyzed
the dump with gdb (the minidump enabled version at 
https://github.com/ssbssa/gdb)

I have to note that the application (drbdadm.exe) is run from a
Windows Service. Furthermore it is not a full cygwin installation
however the cygwin1.dll (3.4.10-1) is in the $PATH.


Thanks for the report. Could you please test cygwin1.dll 3.5.3-1
wihch is the latest cygwin release?


Thanks for your reply.

Yes, sure, will test it with 3.5.3 as well. Due to round trip times
with the client this may take one or 2 weeks, however.

Just wanted to ask if the 3.4 branch is end of life?

Best regards,

- Johannes

--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


cygwin application hangs on closing console

2024-04-22 Thread Johannes Khoshnazar-Thoma via Cygwin

Hi cygwin team :)

I have found something what may be a cygwin bug. Sometimes
(1 out of 1000 times) a drbdadm.exe process (which is part of WinDRBD's
user mode programs originally written for Linux) hangs for several
days on exiting (closing the console). I got a minidump and analyzed
the dump with gdb (the minidump enabled version at 
https://github.com/ssbssa/gdb)

I have to note that the application (drbdadm.exe) is run from a
Windows Service. Furthermore it is not a full cygwin installation
however the cygwin1.dll (3.4.10-1) is in the $PATH.

here is the gdb output:

(gdb) info thread
  Id   Target Id Frame
* 1Thread 0x14c8 0x7ffc6a405ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  2Thread 0x2e0  0x7ffc6a405ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  3Thread 0x1060 0x7ffc6a405ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  4Thread 0x858  0x7ffc6a405ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  5Thread 0xe40  0x7ffc6a405ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) thread 1
[Switching to thread 1 (Thread 0x14c8)]
#0  0x7ffc6a405ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) bt
#0  0x7ffc6a405ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffc66826d1f in WaitForSingleObjectEx () from 
C:\src\dlls-syms\KERNELBASE.dll\6502815021e000\KERNELBASE.dll
#2  0x7ffc492ebb42 in fhandler_console::close (this=0x87f20) at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/fhandler/console.cc:1769
#3  0x7ffc492dc365 in fhandler_base::close_with_arch (this=0x87f20) at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/fhandler/base.cc:1202
#4  0x7ffc49353640 in init_cygheap::close_ctty (this=) at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/mm/cygheap.cc:133
#5  0x7ffc492aee9f in close_all_files (norelease=norelease@entry=false) at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/syscalls.cc:81
#6  0x7ffc49226763 in do_exit (status=0) at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/dcrt0.cc:1125
#7  0x7ffc4922693f in _exit (n=) at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/dcrt0.cc:1240
#8  0x7ffc49390899 in exit (code=0) at 
/usr/src/debug/cygwin-3.4.10-1/newlib/libc/stdlib/exit.c:65
#9  0x7ffc49226923 in cygwin_exit (n=568) at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/dcrt0.cc:1234
#10 0x7ffc492280aa in dll_crt0_1 () at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/dcrt0.cc:999
#11 0x7ffc49225c86 in _cygtls::call2 (this=0x7ce00, func=0x7ffc49226f80 
, arg=0x0, buf=buf@entry=0x7cdf0) at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/cygtls.cc:41
#12 0x7ffc49225d34 in _cygtls::call (func=, arg=) at /usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/cygtls.cc:28
#13 0x in ?? ()
(gdb) thread 1
[Switching to thread 1 (Thread 0x14c8)]
#0  0x7ffc6a405ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) info thread
  Id   Target Id Frame
* 1Thread 0x14c8 0x7ffc6a405ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  2Thread 0x2e0  0x7ffc6a405ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  3Thread 0x1060 0x7ffc6a405ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  4Thread 0x858  0x7ffc6a405ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  5Thread 0xe40  0x7ffc6a405ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) bt
#0  0x7ffc6a405ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffc66826d1f in WaitForSingleObjectEx () from 
C:\src\dlls-syms\KERNELBASE.dll\6502815021e000\KERNELBASE.dll
#2  0x7ffc492ebb42 in fhandler_console::close (this=0x87f20) at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/fhandler/console.cc:1769
#3  0x7ffc492dc365 in fhandler_base::close_with_arch (this=0x87f20) at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/fhandler/base.cc:1202
#4  0x7ffc49353640 in init_cygheap::close_ctty (this=) at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/mm/cygheap.cc:133
#5  0x7ffc492aee9f in close_all_files (norelease=norelease@entry=false) at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/syscalls.cc:81
#6  0x7ffc49226763 in do_exit (status=0) at 
/usr/src/debug/cygwin-3.4.10-1/winsup/cygwin/dcrt0.cc:1125
#7  0x7ffc4922693f in _exit (n=) at