unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: Eli Zaretskii <eliz@gnu.org>,
	Markus Hoenicka <markus.hoenicka@mhoenicka.de>
Cc: 17753@debbugs.gnu.org
Subject: bug#17753: Cygwin emacs-X11 core dump
Date: Wed, 17 Sep 2014 11:17:24 -0400	[thread overview]
Message-ID: <5419A604.8060201@cornell.edu> (raw)
In-Reply-To: <83sijq362c.fsf@gnu.org>

On 9/17/2014 6:16 AM, Eli Zaretskii wrote:
> Anyway, one thing that strikes me (and is consistent across all your
> reports until now) is that atimer.c functions are run from a separate
> thread, not the main thread (which is Thread 1).  Ken, is this normal
> in the Cygwin-w32 build?

Timer functions in general are run in the main thread.  I don't think 
the backtrace of Thread 2 can be trusted.  Something weird is going on 
in Thread 2 in both the Cygwin-w32 build and the Cygwin-X11 build.  And 
it happens only on 64-bit Cygwin (which is where we've been seeing these 
strange crashes).

Here's a sample gdb session using the Cygwin-w32 build on 64-bit Cygwin 
(but I see the same thing with the Cygwin-X11 build):

$ gdb /usr/bin/emacs-w32.exe
GNU gdb (GDB) 7.6.50.20130728-cvs (cygwin-special)
[...]
(gdb) b run_timers
Breakpoint 1 at 0x10064785c: file 
/usr/src/debug/emacs-24.3.93-4/src/atimer.c, line 342.
(gdb) r -Q
Starting program: /usr/bin/emacs-w32.exe -Q
[New Thread 2072.0x1140]
[New Thread 2072.0x25ec]
[New Thread 2072.0x764]
[New Thread 2072.0x22d4]
[New Thread 2072.0x1c08]

Breakpoint 1, run_timers () at 
/usr/src/debug/emacs-24.3.93-4/src/atimer.c:342
342     {
(gdb) thread apply all bt

Thread 5 (Thread 2072.0x1c08):
#0  0x0000000076eb9e6a in USER32!SfmDxSetSwapChainStats ()
    from /c/Windows/system32/USER32.dll
#1  0x0000000076eb9e9e in USER32!GetMessageW ()
    from /c/Windows/system32/USER32.dll
#2  0x0000000000000000 in ?? ()

Thread 4 (Thread 2072.0x22d4):
#0  0x0000000076ff12fa in ntdll!ZwWaitForSingleObject ()
    from /c/Windows/system32/ntdll.dll
#1  0x000007fefce510dc in WaitForSingleObjectEx ()
    from /c/Windows/system32/KERNELBASE.dll
#2  0x0000000000000000 in ?? ()

Thread 3 (Thread 2072.0x764):
#0  0x0000000076ff186a in ntdll!ZwWaitForMultipleObjects ()
    from /c/Windows/system32/ntdll.dll
#1  0x0000000076fbb037 in ntdll!TpIsTimerSet ()
    from /c/Windows/system32/ntdll.dll
#2  0x0000000000000000 in ?? ()

Thread 2 (Thread 2072.0x25ec):
#0  0x0000000076ff131a in ntdll!ZwReadFile () from 
/c/Windows/system32/ntdll.dll
#1  0x000007fefce51a7a in ReadFile () from 
/c/Windows/system32/KERNELBASE.dll
#2  0x000000000042ce00 in ?? ()
#3  0x0000000100647983 in run_timers ()
     at /usr/src/debug/emacs-24.3.93-4/src/atimer.c:364
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 1 (Thread 2072.0x1140):
#0  run_timers () at /usr/src/debug/emacs-24.3.93-4/src/atimer.c:342
#1  0x00000001006479b4 in do_pending_atimers ()
     at /usr/src/debug/emacs-24.3.93-4/src/atimer.c:385
#2  0x000000010053fb87 in process_pending_signals ()
     at /usr/src/debug/emacs-24.3.93-4/src/keyboard.c:7105
#3  0x00000001005b3c53 in Fmake_list (length=0, init=4306501682)
     at /usr/src/debug/emacs-24.3.93-4/src/alloc.c:2644
#4  0x00000001005e4e85 in concat (nargs=1, args=0x429650,
     target_type=Lisp_Cons, last_special=false)
     at /usr/src/debug/emacs-24.3.93-4/src/fns.c:588
#5  0x00000001005e4868 in Fcopy_sequence (arg=25770952502)
     at /usr/src/debug/emacs-24.3.93-4/src/fns.c:456
#6  0x000000010053a111 in timer_check ()
     at /usr/src/debug/emacs-24.3.93-4/src/keyboard.c:4568
[...]

You can see the expected timer functions running in the main thread, but 
I have no idea what's going on in Thread 2.  Is run_timers really being 
called there, or is that just an artifact of a corrupt stack?

Repeating the same steps in 32-bit Cygwin, gives the following:

$ gdb /usr/bin/emacs-w32.exe
GNU gdb (GDB) 7.6.50.20130728-cvs (cygwin-special)
[...]
(gdb) b run_timers
Breakpoint 1 at 0x5e625e: file 
/usr/src/debug/emacs-24.3.93-4/src/atimer.c, line 343.
(gdb) r -Q
Starting program: /usr/bin/emacs-w32.exe -Q
[New Thread 3284.0x25d0]
[New Thread 3284.0x2088]
[New Thread 3284.0x27a0]
[New Thread 3284.0x216c]
[New Thread 3284.0x9d0]

Breakpoint 1, run_timers () at 
/usr/src/debug/emacs-24.3.93-4/src/atimer.c:343
343       struct timespec now = current_timespec ();
(gdb) thread apply all bt

Thread 5 (Thread 3284.0x9d0):
#0  0x769778d7 in USER32!DispatchMessageW () from 
/c/Windows/syswow64/USER32.dll
#1  0x005ffd9c in w32_msg_pump (msg_buf=0x3c0acd8)
     at /usr/src/debug/emacs-24.3.93-4/src/w32fns.c:2450
#2  0x005fffdf in w32_msg_worker@4 (arg=0x0)
     at /usr/src/debug/emacs-24.3.93-4/src/w32fns.c:2676
#3  0x61005eb4 in _cygtls::call2(unsigned long (*)(void*, void*), void*, 
void*)@16 (this=<optimized out>, func=func@entry=0x5fff3f 
<w32_msg_worker@4>,
     arg=0x3c0ac70, arg@entry=0x0, buf=buf@entry=0x3c0cdc4)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:100
#4  0x61006026 in _cygtls::call (func=0x5fff3f <w32_msg_worker@4>, arg=0x0)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/cygtls.cc:30
#5  0x6107d6c8 in threadfunc_fe (arg=<optimized out>)
     at /usr/src/debug/cygwin-1.7.32-1/winsup/cygwin/init.cc:30
#6  0x76bf338a in KERNEL32!BaseThreadInitThunk ()
    from /c/Windows/syswow64/kernel32.dll
#7  0x771b9f72 in ntdll!RtlInitializeExceptionChain ()
    from /c/Windows/system32/ntdll.dll
#8  0x771b9f45 in ntdll!RtlInitializeExceptionChain ()
    from /c/Windows/system32/ntdll.dll
#9  0x00000000 in ?? ()

Thread 4 (Thread 3284.0x216c):
#0  0x7719f8d1 in ntdll!ZwWaitForSingleObject ()
    from /c/Windows/system32/ntdll.dll
#1  0x7719f8d1 in ntdll!ZwWaitForSingleObject ()
    from /c/Windows/system32/ntdll.dll
#2  0x756814ab in WaitForSingleObjectEx ()
    from /c/Windows/syswow64/KERNELBASE.dll
#3  0x00000318 in ?? ()
#4  0x00000000 in ?? ()

Thread 3 (Thread 3284.0x27a0):
#0  0x771a015d in ntdll!ZwWaitForMultipleObjects ()
    from /c/Windows/system32/ntdll.dll
#1  0x771a015d in ntdll!ZwWaitForMultipleObjects ()
    from /c/Windows/system32/ntdll.dll
#2  0x771d2f91 in ntdll!RtlMoveMemory () from /c/Windows/system32/ntdll.dll
#3  0x00000001 in ?? ()
#4  0x00000001 in ?? ()
#5  0x00000000 in ?? ()

Thread 2 (Thread 3284.0x2088):
#0  0x7719f905 in ntdll!ZwReadFile () from /c/Windows/system32/ntdll.dll
#1  0x7719f905 in ntdll!ZwReadFile () from /c/Windows/system32/ntdll.dll
#2  0x7567dd62 in ReadFile () from /c/Windows/syswow64/KERNELBASE.dll
#3  0x00000094 in ?? ()
#4  0x00000000 in ?? ()

Thread 1 (Thread 3284.0x25d0):
#0  run_timers () at /usr/src/debug/emacs-24.3.93-4/src/atimer.c:343
#1  0x005e634c in do_pending_atimers ()
     at /usr/src/debug/emacs-24.3.93-4/src/atimer.c:385
#2  0x0050d946 in process_pending_signals ()
     at /usr/src/debug/emacs-24.3.93-4/src/keyboard.c:7105
#3  0x0056c13e in Fmake_list (length=0, init=9555994)
     at /usr/src/debug/emacs-24.3.93-4/src/alloc.c:2644
#4  0x00594cba in concat (nargs=1, args=0x28a030, target_type=Lisp_Cons,
     last_special=false) at /usr/src/debug/emacs-24.3.93-4/src/fns.c:588
#5  0x005947cf in Fcopy_sequence (arg=-2146299490)
     at /usr/src/debug/emacs-24.3.93-4/src/fns.c:456
#6  0x00508e9f in timer_check ()
     at /usr/src/debug/emacs-24.3.93-4/src/keyboard.c:4571

Notice that Thread 2 doesn't look much different than Threads 3 and 4; 
in particular, it doesn't show that strange call to run_timers.

I think I should take this to the Cygwin list, unless you have other 
suggestions of things to look at.

Ken





  parent reply	other threads:[~2014-09-17 15:17 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-09 21:55 bug#17753: Cygwin emacs-X11 core dump markus.hoenicka
2014-06-11  2:51 ` Eli Zaretskii
2014-06-11  6:16   ` Markus Hoenicka
2014-06-11 14:47     ` Eli Zaretskii
2014-06-13 22:53       ` markus.hoenicka
2014-06-11 12:28   ` Ken Brown
2014-06-11 15:03     ` Eli Zaretskii
2014-07-04 21:21 ` markus.hoenicka
2014-07-05 14:03   ` Ken Brown
2014-07-07 21:31     ` markus.hoenicka
2014-07-09 13:57       ` Ken Brown
2014-07-09 14:30         ` Markus Hoenicka
2014-09-17  9:45           ` Markus Hoenicka
2014-09-17 10:16             ` Eli Zaretskii
2014-09-17 10:52               ` Eli Zaretskii
2014-09-17 11:04                 ` Markus Hoenicka
2014-09-17 15:17               ` Ken Brown [this message]
2014-09-17 17:06                 ` Eli Zaretskii
2014-09-22  7:14                   ` Markus Hoenicka
2014-09-22 13:32                     ` Ken Brown
2014-09-22 14:04                       ` Markus Hoenicka
2014-09-22 14:48                         ` Eli Zaretskii
2014-10-07  7:02                   ` Markus Hoenicka
2014-10-07 14:56                     ` Ken Brown
2014-10-07 15:05                       ` Eli Zaretskii
2014-10-07 16:05                         ` Markus Hoenicka
2014-10-07 17:04                           ` Eli Zaretskii
2014-10-07 20:48                             ` Markus Hoenicka
2014-10-09  8:17                             ` Markus Hoenicka
2014-10-09  8:56                               ` Eli Zaretskii
2014-10-09  9:08                                 ` Markus Hoenicka
2014-10-09 10:35                                   ` Eli Zaretskii
2014-10-09 10:44                                     ` Markus Hoenicka
2014-10-09 11:22                                       ` Eli Zaretskii
2014-10-09 11:47                                         ` Markus Hoenicka
2014-10-09 11:55                                           ` Eli Zaretskii
2014-10-11 15:31                                             ` Ken Brown
2014-10-12  0:07                                               ` Markus Hoenicka
2014-10-20 10:59                                               ` Markus Hoenicka
2014-10-20 11:29                                                 ` Ken Brown
2014-10-20 12:04                                                   ` martin rudalics
2014-10-20 13:05                                                     ` Ken Brown
2014-10-20 14:11                                                   ` Markus Hoenicka
2014-10-20 14:37                                                   ` Markus Hoenicka
2014-10-20 15:24                                                     ` Eli Zaretskii
2014-10-20 15:29                                                       ` Markus Hoenicka
2014-10-24 21:27                                                         ` Ken Brown
2014-10-24 21:42                                                           ` Markus Hoenicka
2014-12-03 12:43                                                           ` Markus Hoenicka
2014-12-03 14:12                                                             ` Ken Brown
2014-10-20 15:29                                                   ` Eli Zaretskii
2014-10-07 16:05                       ` Markus Hoenicka
2014-07-28 22:45         ` markus.hoenicka
2014-08-06 22:02         ` markus.hoenicka
2014-10-07 16:47 ` Achim Gratz
2014-10-07 18:43   ` Ken Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5419A604.8060201@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=17753@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=markus.hoenicka@mhoenicka.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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