unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Barry OReilly <gundaetiapo@gmail.com>
To: Andreas Schwab <schwab@suse.de>
Cc: 15794 <15794@debbugs.gnu.org>
Subject: bug#15794: Core dump after SIGTERM during GC marking
Date: Tue, 5 Nov 2013 10:27:32 -0500	[thread overview]
Message-ID: <CAFM41H2pxb+CziJJfzw9vMbXkURm0Tbn0gH=TwjjaUp=CwBBaw@mail.gmail.com> (raw)
In-Reply-To: <mvma9hkw36m.fsf@hawking.suse.de>

[-- Attachment #1: Type: text/plain, Size: 16316 bytes --]

The bug is not easy to reproduce. In order to facilitate doing so, I
put a sleep in so as it is easier to issue the SIGTERM within GC. I
found GC marking normally takes about 10ms. I applied the following
patch to the Emacs sources:

diff --git a/src/alloc.c b/src/alloc.c
index b35f7c4..1d75e56 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5487,6 +5487,10 @@ See Info node `(elisp)Garbage Collection'.  */)
   gc_in_progress = 1;

   /* Mark all the special slots that serve as the roots of accessibility.
*/
+  { struct timespec debug_ts; char debug_dateStr[20]; {
clock_gettime(CLOCK_REALTIME, &debug_ts); struct tm mytm;
localtime_r(&debug_ts.tv_sec, &mytm); strftime(debug_dateStr, 20,
"%Y-%m-%dT%H:%M:%S", &mytm); }
+       printf( "%s.%09ld|pid:%d|tid:%ld|%s|%d| DEBUG: GC: Start mark\n",
// TODO: debugging
+                         debug_dateStr, debug_ts.tv_nsec, getpid(),
pthread_self(), __FILE__, __LINE__ ); fflush(stdout); }
+  sleep(1);

   mark_buffer (&buffer_defaults);
   mark_buffer (&buffer_local_symbols);
@@ -5545,6 +5549,10 @@ See Info node `(elisp)Garbage Collection'.  */)
       mark_object (BVAR (nextb, undo_list));
     }

+  { struct timespec debug_ts; char debug_dateStr[20]; {
clock_gettime(CLOCK_REALTIME, &debug_ts); struct tm mytm;
localtime_r(&debug_ts.tv_sec, &mytm); strftime(debug_dateStr, 20,
"%Y-%m-%dT%H:%M:%S", &mytm); }
+       printf( "%s.%09ld|pid:%d|tid:%ld|%s|%d| DEBUG: GC: Start sweep\n",
// TODO: debugging
+                         debug_dateStr, debug_ts.tv_nsec, getpid(),
pthread_self(), __FILE__, __LINE__ ); fflush(stdout); }
+
   gc_sweep ();

   /* Clear the mark bits that we set in certain root slots.  */

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:

#0  terminate_due_to_signal (sig=6, backtrace_limit=40) at emacs.c:349
#1  0x0000000000522303 in emacs_abort () at sysdep.c:2123
#2  0x000000000058a2d8 in Fsignal (error_symbol=12904418, data=29814278) at
eval.c:1465
#3  0x000000000058a5b9 in xsignal (error_symbol=6, data=40) at eval.c:1562
#4  0x000000000058aaea in xsignal2 (error_symbol=12904418, arg1=<value
optimized out>, arg2=<value optimized out>) at eval.c:1583
#5  0x00000000005700d6 in wrong_type_argument (predicate=40, value=1) at
data.c:205
#6  0x000000000058e43d in CHECK_TYPE (symbol=40, propname=<value optimized
out>) at lisp.h:953
#7  CHECK_SYMBOL (symbol=40, propname=<value optimized out>) at lisp.h:2402
#8  Fget (symbol=40, propname=<value optimized out>) at fns.c:1861
#9  0x00000000005c7709 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=12844642, nargs=0, args=0x4e) at bytecode.c:1332
#10 0x00000000005889e9 in eval_sub (form=<value optimized out>) at
eval.c:2165
#11 0x000000000058bf57 in internal_lisp_condition_case (var=12844642,
bodyform=26306566, handlers=<value optimized out>) at eval.c:1300
#12 0x00000000005c6f66 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=12844642, nargs=0, args=0x8f) at bytecode.c:1169
#13 0x000000000058909c in funcall_lambda (fun=25511693, nargs=2,
arg_vector=0x7fffffff82a0) at eval.c:3023
#14 0x000000000058935c in Ffuncall (nargs=3, args=<value optimized out>) at
eval.c:2850
#15 0x00000000005c5450 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=12844642, nargs=0, args=0x22) at bytecode.c:919
#16 0x000000000058909c in funcall_lambda (fun=21562829, nargs=2,
arg_vector=0x7fffffff8440) at eval.c:3023
#17 0x000000000058935c in Ffuncall (nargs=3, args=<value optimized out>) at
eval.c:2850
#18 0x00000000005c5450 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=12844642, nargs=0, args=0x22) at bytecode.c:919
#19 0x000000000058909c in funcall_lambda (fun=29060741, nargs=2,
arg_vector=0x7fffffff85d8) at eval.c:3023
#20 0x000000000058935c in Ffuncall (nargs=3, args=<value optimized out>) at
eval.c:2850
#21 0x0000000000589bdf in Fapply (nargs=2, args=0x7fffffff86c0) at
eval.c:2328
#22 0x00000000005895dc in Ffuncall (nargs=3, args=<value optimized out>) at
eval.c:2770
#23 0x00000000005c5450 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=12844642, nargs=0, args=0x22) at bytecode.c:919
#24 0x000000000058909c in funcall_lambda (fun=21522045, nargs=2,
arg_vector=0x7fffffff8820) at eval.c:3023
#25 0x000000000058a8f1 in apply_lambda (fun=21522045, args=26334146) at
eval.c:2898
#26 0x0000000000588336 in eval_sub (form=4611686018628714496) at eval.c:2234
#27 0x0000000000588d4f in Fprogn (body=<value optimized out>) at eval.c:447
#28 0x0000000000589032 in funcall_lambda (fun=29225190, nargs=2,
arg_vector=0x7fffffff8a30) at eval.c:3016
#29 0x000000000058935c in Ffuncall (nargs=3, args=<value optimized out>) at
eval.c:2850
#30 0x00000000005c5450 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=12844642, nargs=0, args=0x22) at bytecode.c:919
#31 0x000000000058909c in funcall_lambda (fun=29060941, nargs=2,
arg_vector=0x7fffffff8bc8) at eval.c:3023
#32 0x000000000058935c in Ffuncall (nargs=3, args=<value optimized out>) at
eval.c:2850
#33 0x0000000000589bdf in Fapply (nargs=2, args=0x7fffffff8cb0) at
eval.c:2328
#34 0x00000000005895dc in Ffuncall (nargs=3, args=<value optimized out>) at
eval.c:2770
#35 0x00000000005c5450 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=12844642, nargs=0, args=0x22) at bytecode.c:919
#36 0x000000000058909c in funcall_lambda (fun=28959853, nargs=2,
arg_vector=0x7fffffff8e50) at eval.c:3023
#37 0x000000000058935c in Ffuncall (nargs=3, args=<value optimized out>) at
eval.c:2850
#38 0x00000000005c5450 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=12844642, nargs=0, args=0x22) at bytecode.c:919
#39 0x000000000058909c in funcall_lambda (fun=29369645, nargs=2,
arg_vector=0x7fffffff8ff0) at eval.c:3023
#40 0x000000000058935c in Ffuncall (nargs=3, args=<value optimized out>) at
eval.c:2850
#41 0x00000000005c5450 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=12844642, nargs=0, args=0x22) at bytecode.c:919
#42 0x000000000058909c in funcall_lambda (fun=28595629, nargs=0,
arg_vector=0x7fffffff9180) at eval.c:3023
#43 0x000000000058935c in Ffuncall (nargs=1, args=<value optimized out>) at
eval.c:2850
#44 0x00000000005c5450 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=12844642, nargs=0, args=0x20) at bytecode.c:919
#45 0x000000000058909c in funcall_lambda (fun=28892277, nargs=1,
arg_vector=0x7fffffff9310) at eval.c:3023
#46 0x000000000058935c in Ffuncall (nargs=2, args=<value optimized out>) at
eval.c:2850
#47 0x00000000005c5450 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=12844642, nargs=0, args=0x21) at bytecode.c:919
#48 0x000000000058909c in funcall_lambda (fun=28595133, nargs=0,
arg_vector=0x7fffffff94e8) at eval.c:3023
#49 0x000000000058935c in Ffuncall (nargs=1, args=<value optimized out>) at
eval.c:2850
#50 0x0000000000589a69 in funcall_nil (nargs=6, args=0x28) at eval.c:2340
#51 0x0000000000586be0 in run_hook_with_args (nargs=1, args=0x7fffffff94e0,
funcall=0x589a60 <funcall_nil>) at eval.c:2525
#52 0x0000000000586c85 in Frun_hooks (nargs=1, args=0x7fffffff95a8) at
eval.c:2367
#53 0x00000000005895dc in Ffuncall (nargs=2, args=<value optimized out>) at
eval.c:2770
#54 0x00000000005c5450 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=5120, nargs=2, args=0x21) at bytecode.c:919
#55 0x000000000058935c in Ffuncall (nargs=3, args=<value optimized out>) at
eval.c:2850
#56 0x00000000005c5450 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=6168, nargs=6, args=0x22) at bytecode.c:919
#57 0x000000000058935c in Ffuncall (nargs=7, args=<value optimized out>) at
eval.c:2850
#58 0x00000000005c5450 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=4100, nargs=2, args=0x26) at bytecode.c:919
#59 0x000000000058935c in Ffuncall (nargs=3, args=<value optimized out>) at
eval.c:2850
#60 0x00000000005c5450 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=12844642, nargs=0, args=0x22) at bytecode.c:919
#61 0x00000000005889e9 in eval_sub (form=<value optimized out>) at
eval.c:2165
#62 0x000000000058bf57 in internal_lisp_condition_case (var=12844642,
bodyform=27909238, handlers=<value optimized out>) at eval.c:1300
#63 0x00000000005c6f66 in exec_byte_code (bytestr=6, vector=40, maxdepth=1,
args_template=12844642, nargs=0, args=0x8f) at bytecode.c:1169
#64 0x000000000058909c in funcall_lambda (fun=28480253, nargs=0,
arg_vector=0x7fffffff9e68) at eval.c:3023
#65 0x000000000058935c in Ffuncall (nargs=1, args=<value optimized out>) at
eval.c:2850
#66 0x0000000000589a69 in funcall_nil (nargs=6, args=0x28) at eval.c:2340
#67 0x0000000000586be0 in run_hook_with_args (nargs=1, args=0x7fffffff9e60,
funcall=0x589a60 <funcall_nil>) at eval.c:2525
#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
#71 0x000000000052238e in handle_fatal_signal (sig=6) at sysdep.c:1624
#72 0x0000000000522895 in deliver_process_signal (sig=15, handler=0x522380
<handle_fatal_signal>) at sysdep.c:1564
#73 <signal handler called>
#74 0x00000031cf09a080 in __nanosleep_nocancel () from /lib64/libc.so.6
#75 0x00000031cf099ed4 in sleep () from /lib64/libc.so.6
#76 0x000000000056ea7e in Fgarbage_collect () at alloc.c:5493
#77 0x000000000058810a in maybe_gc (form=29416886) at lisp.h:4387
#78 eval_sub (form=29416886) at eval.c:2058
#79 0x00000000005b063f in readevalloop (readcharfun=12973922,
stream=0x1b34e70, sourcename=17010609, printflag=false, unibyte=<value
optimized out>, readfun=12844642, start=12844642, end=12844642) at
lread.c:1876
#80 0x00000000005b45db in Fload (file=27104785, noerror=<value optimized
out>, nomessage=12844690, nosuffix=<value optimized out>,
must_suffix=<value optimized out>) at lread.c:1352
#81 0x0000000000593f46 in Frequire (feature=28527506, filename=27104785,
noerror=12844642) at fns.c:2658
#82 0x00000000005897bb in Ffuncall (nargs=2, args=<value optimized out>) at
eval.c:2796
#83 0x00000000005c5450 in exec_byte_code (bytestr=140737488332304,
vector=140737488332304, maxdepth=0, args_template=12844642, nargs=0,
args=0x21) at bytecode.c:919
#84 0x00000000005889e9 in eval_sub (form=<value optimized out>) at
eval.c:2165
#85 0x00000000005b063f in readevalloop (readcharfun=12973922,
stream=0x1b94f90, sourcename=15942977, printflag=false, unibyte=<value
optimized out>, readfun=12844642, start=12844642, end=12844642) at
lread.c:1876
#86 0x00000000005b45db in Fload (file=27125345, noerror=<value optimized
out>, nomessage=12844690, nosuffix=<value optimized out>,
must_suffix=<value optimized out>) at lread.c:1352
#87 0x0000000000593f46 in Frequire (feature=28526530, filename=27125345,
noerror=12844642) at fns.c:2658
#88 0x00000000005897bb in Ffuncall (nargs=2, args=<value optimized out>) at
eval.c:2796
#89 0x00000000005c5450 in exec_byte_code (bytestr=140737488332304,
vector=140737488332304, maxdepth=0, args_template=12844642, nargs=0,
args=0x21) at bytecode.c:919
#90 0x00000000005889e9 in eval_sub (form=<value optimized out>) at
eval.c:2165
#91 0x00000000005b063f in readevalloop (readcharfun=12973922,
stream=0x1b373d0, sourcename=27422081, printflag=false, unibyte=<value
optimized out>, readfun=12844642, start=12844642, end=12844642) at
lread.c:1876
#92 0x00000000005b45db in Fload (file=27463873, noerror=<value optimized
out>, nomessage=12844690, nosuffix=<value optimized out>,
must_suffix=<value optimized out>) at lread.c:1352
#93 0x0000000000593f46 in Frequire (feature=29444146, filename=27463873,
noerror=12844642) at fns.c:2658
#94 0x00000000005889e9 in eval_sub (form=<value optimized out>) at
eval.c:2165
#95 0x0000000000588d4f in Fprogn (body=<value optimized out>) at eval.c:447
#96 0x000000000058860a in eval_sub (form=<value optimized out>) at
eval.c:2107
#97 0x000000000058860a in eval_sub (form=<value optimized out>) at
eval.c:2107
#98 0x00000000005b063f in readevalloop (readcharfun=16137829, stream=0x0,
sourcename=15822161, printflag=false, unibyte=<value optimized out>,
readfun=12844642, start=12844642, end=12844642) at lread.c:1876
#99 0x00000000005b1eab in Feval_buffer (buffer=<value optimized out>,
printflag=12844642, filename=16137681, unibyte=12844642,
do_allow_print=12844690) at lread.c:1937
#100 0x000000000058983f in Ffuncall (nargs=6, args=<value optimized out>)
at eval.c:2805
#101 0x00000000005c5450 in exec_byte_code (bytestr=140737488332304,
vector=140737488332304, maxdepth=0, args_template=12844642, nargs=0,
args=0x25) at bytecode.c:919
#102 0x000000000058909c in funcall_lambda (fun=9040965, nargs=4,
arg_vector=0x7fffffffbc38) at eval.c:3023
#103 0x000000000058935c in Ffuncall (nargs=5, args=<value optimized out>)
at eval.c:2850
#104 0x0000000000589949 in call4 (fn=<value optimized out>, arg1=<value
optimized out>, arg2=0, arg3=-1, arg4=0) at eval.c:2637
#105 0x00000000005b447c in Fload (file=16139217, noerror=12844690,
nomessage=12844690, nosuffix=<value optimized out>, must_suffix=12844642)
at lread.c:1294
#106 0x000000000058983f in Ffuncall (nargs=4, args=<value optimized out>)
at eval.c:2805
#107 0x00000000005c5450 in exec_byte_code (bytestr=140737488332304,
vector=140737488332304, maxdepth=0, args_template=0, nargs=0, args=0x23) at
bytecode.c:919
#108 0x000000000058935c in Ffuncall (nargs=1, args=<value optimized out>)
at eval.c:2850
#109 0x00000000005c5450 in exec_byte_code (bytestr=140737488332304,
vector=140737488332304, maxdepth=0, args_template=0, nargs=0, args=0x20) at
bytecode.c:919
#110 0x000000000058935c in Ffuncall (nargs=1, args=<value optimized out>)
at eval.c:2850
#111 0x000000000058871f in eval_sub (form=<value optimized out>) at
eval.c:2131
#112 0x000000000058bf57 in internal_lisp_condition_case (var=16899698,
bodyform=12817510, handlers=<value optimized out>) at eval.c:1300
#113 0x00000000005c6f66 in exec_byte_code (bytestr=140737488332304,
vector=140737488332304, maxdepth=0, args_template=0, nargs=0, args=0x8f) at
bytecode.c:1169
#114 0x000000000058935c in Ffuncall (nargs=1, args=<value optimized out>)
at eval.c:2850
#115 0x00000000005c5450 in exec_byte_code (bytestr=140737488332304,
vector=140737488332304, maxdepth=0, args_template=0, nargs=0, args=0x20) at
bytecode.c:919
#116 0x000000000058a8f1 in apply_lambda (fun=9398557, args=12844642) at
eval.c:2898
#117 0x0000000000588336 in eval_sub (form=4611686018628714496) at
eval.c:2234
#118 0x000000000058b212 in Feval (form=16182630, lexical=<value optimized
out>) at eval.c:1977
#119 0x00000000005871c4 in internal_condition_case (bfun=0x509f30
<top_level_2>, handlers=12904226, hfun=0x50f0e0 <cmd_error>) at eval.c:1331
#120 0x000000000050d5f6 in top_level_1 (ignore=<value optimized out>) at
keyboard.c:1175
#121 0x0000000000587088 in internal_catch (tag=12900162, func=0x50d590
<top_level_1>, arg=12844642) at eval.c:1097
#122 0x000000000050d468 in command_loop () at keyboard.c:1136
#123 recursive_edit_1 () at keyboard.c:776
#124 0x000000000050e5a7 in Frecursive_edit () at keyboard.c:840
#125 0x0000000000504a2d in main (argc=<value optimized out>,
argv=0x7fffffffc8e8) at emacs.c:1592

Lisp Backtrace:
"byte-code" (0xffff7fc0)
"eieio-oref" (0xffff82a0)
"slot-boundp" (0xffff8440)
"ede-project-autoload" (0xffff85d8)
"apply" (0xffff86c0)
"eieio-generic-call-primary-only" (0xffff8820)
"ede-project-root-directory" (0xffff8a30)
0x1bb6f48 PVEC_COMPILED
"apply" (0xffff8cb0)
"ede-dir-to-projectfile" (0xffff8e50)
"ede-directory-project-p" (0xffff8ff0)
"ede-initialize-state-current-buffer" (0xffff9180)
"ede-minor-mode" (0xffff9310)
"ede-turn-on-hook" (0xffff94e8)
"run-hooks" (0xffff95a8)
"after-find-file" (0xffff9728)
"find-file-noselect-1" (0xffff98f0)
"find-file-noselect" (0xffff9a50)
"byte-code" (0xffff9b60)
"ede-save-cache" (0xffff9e68)
"Automatic GC" (0xc33108)
"require" (0xffffad50)
"byte-code" (0xffffae50)
"require" (0xffffb250)
"byte-code" (0xffffb350)
"require" (0xffffb6f0)
"progn" (0xffffb808)
"if" (0xffffb8c8)
"eval-buffer" (0xffffba90)
"load-with-code-conversion" (0xffffbc38)
"load" (0xffffbee8)
0x8f8610 PVEC_COMPILED
0xf72a28 PVEC_COMPILED
"funcall" (0xffffc160)
"command-line" (0xffffc478)
"normal-top-level" (0xffffc570)

[-- Attachment #2: Type: text/html, Size: 17916 bytes --]

  reply	other threads:[~2013-11-05 15:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-03  4:28 bug#15794: Core dump after SIGTERM during GC marking Barry OReilly
2013-11-03  6:37 ` Andreas Schwab
2013-11-03 17:41   ` Eli Zaretskii
2013-11-03 18:03     ` Andreas Schwab
2013-11-03 19:52       ` Eli Zaretskii
2013-11-03 20:29         ` Barry OReilly
2013-11-03 20:39           ` Eli Zaretskii
2013-11-03 20:42           ` Eli Zaretskii
2013-11-03 22:22         ` Andreas Schwab
2013-11-04  3:38           ` Eli Zaretskii
2013-11-04  8:56             ` Andreas Schwab
2013-11-04 16:02               ` Eli Zaretskii
2013-11-04 16:18                 ` Andreas Schwab
2013-11-05 15:27                   ` Barry OReilly [this message]
2013-11-05 15:53                     ` Eli Zaretskii
2013-11-05 16:52                       ` Barry OReilly
2013-11-05 17:16                         ` Eli Zaretskii
2019-09-29 14:00                           ` Lars Ingebrigtsen
2013-11-03 17:39 ` Eli Zaretskii

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='CAFM41H2pxb+CziJJfzw9vMbXkURm0Tbn0gH=TwjjaUp=CwBBaw@mail.gmail.com' \
    --to=gundaetiapo@gmail.com \
    --cc=15794@debbugs.gnu.org \
    --cc=schwab@suse.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).