Subject: Re: bug#15794: Core dump after SIGTERM during GC marking

From: Eli Zaretskii <[email-masked]>
Date: Tue, 05 Nov 2013 17:53:17 +0200

> Date: Tue, 5 Nov 2013 10:27:32 -0500
> From: Barry OReilly <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>, 15794 <[email-masked]>
> 
> I then started Emacs via GDB and issued a SIGTERM during the sleep. As
> before, I witnessed an abort in a kill hook. The C and Lisp
> backtraces:

Thanks.  But the Lisp backtrace doesn't tell which function of the
kill-emacs-hook was running, and the C backtrace is different (no
trace of regexp functions) anyway, and GC didn't really start doing
its job, so it's not exactly the same crash.

To try and see which function from those that are in kill-emacs-hook,
go to frame #68:

> #68 0x0000000000586c85 in Frun_hooks (nargs=1, args=0xbd2200) at eval.c:2367
> #69 0x00000000005031d5 in Fkill_emacs (arg=60) at emacs.c:1891
> #70 0x0000000000503300 in terminate_due_to_signal (sig=15,
> backtrace_limit=40) at emacs.c:359

And look at the variable 'args', which should be a list.  Since this
session crashed in GC, it is not safe to print Lisp objects with "pp"
and its likes.  Instead, you will have to walk the list using "xcar"
and "xcdr", display the type of each object in the list using "xtype",
and then display the object itself with the appropriate x* command,
normally "xsymbol", since the list is constructed from function
symbols.

If you cannot do this in frame 68 for some reason (yours is an
optimized build, so variables might not reflect the true state of
affairs), try the frame above it:

> #67 0x0000000000586be0 in run_hook_with_args (nargs=1, args=0x7fffffff9e60,
> funcall=0x589a60 <funcall_nil>) at eval.c:2525

Again, look at 'args'.

Btw, I'm not sure what we are trying to establish here.  Shutting down
Emacs in the middle of GC is inherently dangerous.