public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Threads
@ 2014-10-20 13:04 Ken Brown
  2014-10-20 16:43 ` Threads Corinna Vinschen
  2014-10-23 11:31 ` Threads Jon TURNEY
  0 siblings, 2 replies; 23+ messages in thread
From: Ken Brown @ 2014-10-20 13:04 UTC (permalink / raw)
  To: cygwin

When trying to debug emacs in gdb, I see several threads, but it's not always 
clear who created those threads and what they're doing.  As an example, I 
attached gdb to an emacs-X11 process (running under X) shortly after starting 
it, and I obtained the backtrace appended at the end of this message.

I assume Thread 12 was created by gdb.  Thread 6 appears to be a timer thread 
and Thread 2 appears to be a signal thread; I assume both of these were created 
by the Cygwin DLL.  And Thread 1 is the main thread.  I don't have any idea 
where the other threads came from.  Presumably at least one of them was created 
by Glib.

The situation is similar with emacs-w32 and emacs-nox, but with fewer threads.

In general, is there a way I can understand where all the threads come from?  My 
reason for asking is that we're still getting emacs bug reports on 64-bit 
Cygwin, with random crashes or assertion violations that are "impossible" 
according to the gdb backtraces. [*]  So I'm wondering whether they're caused by 
interference from other threads.

Or is there some other plausible explanation for "impossible" crashes?  This 
can't just be a result of a gdb bug, because in at least one case the assertion 
can be shown to be valid by using printf instead of gdb.

Ken

[*] By "impossible" I mean that examination of the relevant variables in gdb 
shows that the assertions are in fact true.  Two ongoing examples are

    http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18438
    http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18769


=============thread apply all bt==============================

Thread 12 (Thread 6288.0x554):
#0  0x0000000077b50591 in ntdll!DbgBreakPoint ()
     at /c/Windows/SYSTEM32/ntdll.dll
#1  0x0000000077bf7f48 in ntdll!DbgUiRemoteBreakin ()
     at /c/Windows/SYSTEM32/ntdll.dll
#2  0x00000000779f59ed in KERNEL32!BaseThreadInitThunk ()
     at /c/Windows/system32/kernel32.dll
#3  0x0000000077b2c541 in ntdll!RtlUserThreadStart ()
     at /c/Windows/SYSTEM32/ntdll.dll
#4  0x0000000000000000 in  ()

Thread 11 (Thread 6288.0x2280):
#0  0x0000000077b52bba in ntdll!ZwWaitForWorkViaWorkerFactory ()
     at /c/Windows/SYSTEM32/ntdll.dll
#1  0x0000000077b1fe3b in ntdll!RtlValidateHeap ()
     at /c/Windows/SYSTEM32/ntdll.dll
#2  0x000000018004619b in _cygtls::call2(unsigned int (*)(void*, void*), void*, 
void*) (this=0x2000002, func=0x0, arg=0x5e82d0, buf=buf@entry=0x47bcd50)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:100
#3  0x00000001800462f4 in _cygtls::call(unsigned int (*)(void*, void*), void*) 
(func=<optimized out>, arg=<optimized out>)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:30
#4  0x00000000779f59ed in KERNEL32!BaseThreadInitThunk ()
     at /c/Windows/system32/kernel32.dll
#5  0x0000000077b2c541 in ntdll!RtlUserThreadStart ()
     at /c/Windows/SYSTEM32/ntdll.dll
#6  0x0000000000000000 in  ()

Thread 10 (Thread 6288.0x22c0):
#0  0x0000000077b52bba in ntdll!ZwWaitForWorkViaWorkerFactory ()
     at /c/Windows/SYSTEM32/ntdll.dll
#1  0x0000000077b1fe3b in ntdll!RtlValidateHeap ()
     at /c/Windows/SYSTEM32/ntdll.dll
#2  0x000000018004619b in _cygtls::call2(unsigned int (*)(void*, void*), void*, 
void*) (this=0x2000002, func=0x29000029, arg=0x5e82d0, buf=buf@entry=0x4bbcd50)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:100
#3  0x00000001800462f4 in _cygtls::call(unsigned int (*)(void*, void*), void*) 
(func=<optimized out>, arg=<optimized out>)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:30
#4  0x00000000779f59ed in KERNEL32!BaseThreadInitThunk ()
     at /c/Windows/system32/kernel32.dll
#5  0x0000000077b2c541 in ntdll!RtlUserThreadStart ()
     at /c/Windows/SYSTEM32/ntdll.dll
#6  0x0000000000000000 in  ()

Thread 9 (Thread 6288.0x1e98):
#0  0x0000000077b515fa in ntdll!ZwDelayExecution ()
     at /c/Windows/SYSTEM32/ntdll.dll
#1  0x000007fefda11203 in SleepEx () at /c/Windows/system32/KERNELBASE.dll
#2  0x000000018010d970 in thread_pipe(void*) (arg=0x600d2bfe0)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/select.cc:690
#3  0x0000000180044fc5 in cygthread::callfunc(bool) (this=this@entry=0x1801d0500 
<threads+352>, issimplestub=issimplestub@entry=false)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygthread.cc:51
#4  0x000000018004552a in cygthread::stub(void*) (arg=arg@entry=0x1801d0500 
<threads+352>) at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygthread.cc:93
#5  0x000000018004619b in _cygtls::call2(unsigned int (*)(void*, void*), void*, 
void*) (this=0x43bce00, func=
     0x1800454d0 <cygthread::stub(void*)>, arg=0x1801d0500 <threads+352>, 
buf=buf@entry=0x43bcd50) at 
/usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:100
#6  0x00000001800462f4 in _cygtls::call(unsigned int (*)(void*, void*), void*) 
(func=<optimized out>, arg=<optimized out>)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:30
#7  0x00000000779f59ed in KERNEL32!BaseThreadInitThunk ()
     at /c/Windows/system32/kernel32.dll
#8  0x0000000077b2c541 in ntdll!RtlUserThreadStart ()
     at /c/Windows/SYSTEM32/ntdll.dll
#9  0x0000000000000000 in  ()

Thread 8 (Thread 6288.0x1ae4):
#0  0x0000000077b5186a in ntdll!ZwWaitForMultipleObjects ()
     at /c/Windows/SYSTEM32/ntdll.dll
#1  0x000007fefda11430 in KERNELBASE!GetCurrentProcess ()
     at /c/Windows/system32/KERNELBASE.dll
#2  0x0000000000000000 in  ()

Thread 7 (Thread 6288.0x1bac):
#0  0x0000000077b5134a in ntdll!ZwRemoveIoCompletion ()
     at /c/Windows/SYSTEM32/ntdll.dll
#1  0x000007fefd095941 in  () at /c/Windows/System32/mswsock.dll
#2  0x0000000000000000 in  ()

Thread 6 (Thread 6288.0xf40):
#0  0x0000000077b512fa in ntdll!ZwWaitForSingleObject ()
     at /c/Windows/SYSTEM32/ntdll.dll
#1  0x000007fefda110dc in WaitForSingleObjectEx ()
     at /c/Windows/system32/KERNELBASE.dll
#2  0x000000018013db94 in timer_thread(void*) (x=0x37ba9d8)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/timer.cc:145
#3  0x0000000180044fc5 in cygthread::callfunc(bool) (this=this@entry=0x1801d0450 
<threads+176>, issimplestub=issimplestub@entry=false)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygthread.cc:51
#4  0x000000018004552a in cygthread::stub(void*) (arg=arg@entry=0x1801d0450 
<threads+176>) at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygthread.cc:93
#5  0x000000018004619b in _cygtls::call2(unsigned int (*)(void*, void*), void*, 
void*) (this=0x37bce00, func=
     0x1800454d0 <cygthread::stub(void*)>, arg=0x1801d0450 <threads+176>, 
buf=buf@entry=0x37bcd50) at 
/usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:100
#6  0x00000001800462f4 in _cygtls::call(unsigned int (*)(void*, void*), void*) 
(func=<optimized out>, arg=<optimized out>)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:30
#7  0x00000000779f59ed in KERNEL32!BaseThreadInitThunk ()
     at /c/Windows/system32/kernel32.dll
#8  0x0000000077b2c541 in ntdll!RtlUserThreadStart ()
     at /c/Windows/SYSTEM32/ntdll.dll
#9  0x0000000000000000 in  ()

Thread 5 (Thread 6288.0x1cc0):
#0  0x0000000077b515fa in ntdll!ZwDelayExecution ()
     at /c/Windows/SYSTEM32/ntdll.dll
#1  0x000007fefda11203 in SleepEx () at /c/Windows/system32/KERNELBASE.dll
#2  0x000000018010d970 in thread_pipe(void*) (arg=0x600045f20)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/select.cc:690
#3  0x0000000180044fc5 in cygthread::callfunc(bool) (this=this@entry=0x1801d03f8 
<threads+88>, issimplestub=issimplestub@entry=false)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygthread.cc:51
#4  0x000000018004552a in cygthread::stub(void*) (arg=arg@entry=0x1801d03f8 
<threads+88>) at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygthread.cc:93
#5  0x000000018004619b in _cygtls::call2(unsigned int (*)(void*, void*), void*, 
void*) (this=0x33bce00, func=
     0x1800454d0 <cygthread::stub(void*)>, arg=0x1801d03f8 <threads+88>, 
buf=buf@entry=0x33bcd50) at 
/usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:100
#6  0x00000001800462f4 in _cygtls::call(unsigned int (*)(void*, void*), void*) 
(func=<optimized out>, arg=<optimized out>)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:30
#7  0x00000000779f59ed in KERNEL32!BaseThreadInitThunk ()
     at /c/Windows/system32/kernel32.dll
#8  0x0000000077b2c541 in ntdll!RtlUserThreadStart ()
     at /c/Windows/SYSTEM32/ntdll.dll
#9  0x0000000000000000 in  ()

Thread 4 (Thread 6288.0x620):
#0  0x0000000077b5186a in ntdll!ZwWaitForMultipleObjects ()
     at /c/Windows/SYSTEM32/ntdll.dll
#1  0x000007fefda11430 in KERNELBASE!GetCurrentProcess ()
     at /c/Windows/system32/KERNELBASE.dll
#2  0x0000000000000000 in  ()

Thread 3 (Thread 6288.0x50c):
#0  0x0000000077b5186a in ntdll!ZwWaitForMultipleObjects ()
     at /c/Windows/SYSTEM32/ntdll.dll
#1  0x0000000077b1b037 in ntdll!TpIsTimerSet () at /c/Windows/SYSTEM32/ntdll.dll
#2  0x00000000779f59ed in KERNEL32!BaseThreadInitThunk ()
     at /c/Windows/system32/kernel32.dll
#3  0x0000000077b2c541 in ntdll!RtlUserThreadStart ()
     at /c/Windows/SYSTEM32/ntdll.dll
#4  0x0000000000000000 in  ()

Thread 2 (Thread 6288.0x4ec):
#0  0x0000000077b5131a in ntdll!ZwReadFile () at /c/Windows/SYSTEM32/ntdll.dll
#1  0x000007fefda11a7a in ReadFile () at /c/Windows/system32/KERNELBASE.dll
#2  0x00000000779f0a19 in ReadFile () at /c/Windows/system32/kernel32.dll
#3  0x00000001801197c2 in wait_sig(void*) ()
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/sigproc.cc:1239
#4  0x0000000180044fc5 in cygthread::callfunc(bool) (this=this@entry=0x1801d03a0 
<threads>, issimplestub=issimplestub@entry=false)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygthread.cc:51
#5  0x000000018004552a in cygthread::stub(void*) (arg=arg@entry=0x1801d03a0 
<threads>) at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygthread.cc:93
#6  0x000000018004619b in _cygtls::call2(unsigned int (*)(void*, void*), void*, 
void*) (this=0x23ace00, func=
     0x1800454d0 <cygthread::stub(void*)>, arg=0x1801d03a0 <threads>, 
buf=buf@entry=0x23acd50) at 
/usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:100
#7  0x00000001800462f4 in _cygtls::call(unsigned int (*)(void*, void*), void*) 
(func=<optimized out>, arg=<optimized out>)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:30
#8  0x00000000779f59ed in KERNEL32!BaseThreadInitThunk ()
     at /c/Windows/system32/kernel32.dll
#9  0x0000000077b2c541 in ntdll!RtlUserThreadStart ()
     at /c/Windows/SYSTEM32/ntdll.dll
#10 0x0000000000000000 in  ()

Thread 1 (Thread 6288.0x2304):
#0  0x0000000077b5186a in ntdll!ZwWaitForMultipleObjects ()
     at /c/Windows/SYSTEM32/ntdll.dll
#1  0x000007fefda11430 in KERNELBASE!GetCurrentProcess ()
     at /c/Windows/system32/KERNELBASE.dll
#2  0x0000000000000001 in  ()
Continuing.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2014-10-29 10:00 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-20 13:04 Threads Ken Brown
2014-10-20 16:43 ` Threads Corinna Vinschen
2014-10-20 19:03   ` Threads Corinna Vinschen
2014-10-20 19:58     ` Threads Ken Brown
2014-10-21 11:17       ` Threads Corinna Vinschen
2014-10-21 12:27         ` Threads Ken Brown
2014-10-23 11:31 ` Threads Jon TURNEY
2014-10-23 12:04   ` Threads Ken Brown
2014-10-23 15:37     ` Threads Corinna Vinschen
2014-10-23 18:07       ` Threads Achim Gratz
2014-10-23 20:32       ` Threads Ken Brown
2014-10-24  1:07         ` Threads Ken Brown
2014-10-24  9:46           ` Threads Corinna Vinschen
2014-10-24 11:05       ` Threads Jon TURNEY
2014-10-24 12:54         ` Threads Corinna Vinschen
2014-10-24 13:52           ` Threads Corinna Vinschen
2014-10-26 11:58             ` Threads Ken Brown
2014-10-28 10:44             ` Threads Jon TURNEY
2014-10-28 11:40               ` Threads Corinna Vinschen
2014-10-28 13:47                 ` Threads Ken Brown
2014-10-28 14:19                   ` [GOLDSTARS] Threads Corinna Vinschen
2014-10-28 17:39                     ` Andrew Schulman
2014-10-29 10:00                       ` Corinna Vinschen

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).