Subject: bug#33091: 27.0.50; Daily+ crashes in auto-save-hook

From: Eli Zaretskii <[email-masked]>
Date: Thu, 18 Oct 2018 23:09:04 +0300

> From: "Mark A. Hershberger" <[email-masked]>
> Date: Thu, 18 Oct 2018 14:56:59 -0400
> 
> 
> The backtraces happen while working on a file, apparently when auto-save
> is invoked

No, this isn't a crash in auto-save-hook, it's a segfault in GC:

> #0  raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:51
>         set = {__val = {18446744067266838239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 268435456, 56701040, 1, 6051501, 18446744067266838271}}
>         pid = <optimized out>
>         tid = <optimized out>
> #1  0x0000000000597dfa in terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at emacs.c:400
> No locals.
> #2  0x0000000000630fa5 in die (msg=0x77c143 "0 <= nchars", file=0x77c060 "lisp.h", line=1488) at alloc.c:7096
> No locals.
> #3  0x0000000000591e2b in SCHARS (string=...) at lisp.h:1488
>         nchars = -9223372036854775794
> #4  0x0000000000695e03 in oblookup (obarray=..., ptr=0x78a2be "auto-save-hook", size=14, size_byte=14) at lread.c:4333
>         hash = 14424
>         obsize = 15121
>         tail = {i = 0x51df70 <bidi_fetch_char+549>}
>         bucket = {i = 0x5252eb0}
>         tem = {i = 0xe59f60 <lispsym>}
> #5  0x0000000000695618 in intern_1 (str=0x78a2be "auto-save-hook", len=14) at lread.c:4141
>         obarray = {i = 0xec7015 <bss_sbrk_buffer+297653>}
>         tem = {i = 0x0}
> #6  0x0000000000594833 in intern (str=0x78a2be "auto-save-hook") at lisp.h:3855
> No locals.
> #7  0x00000000005f8cec in Fdo_auto_save (no_message=..., current_only=...) at fileio.c:5642
>         old = 0x7d3c820
>         b = 0x0
>         tail = {i = 0xe42bc0 <sigsegv_stack+6016>}
>         buf = {i = 0x9c30}
>         hook = {i = 0x9c30}
>         auto_saved = false
>         do_handled_files = 5838245
>         oquit = {i = 0x0}
>         stream = 0x0
>         count = 43
>         orig_minibuffer_auto_raise = false
>         old_message_p = false
>         auto_save_unwind = {stream = 0x592160 <PSEUDOVECTORP+57>, auto_raise = 18}
> #8  0x000000000059a6ff in shut_down_emacs (sig=11, stuff=...) at emacs.c:2122
> No locals.
> #9  0x0000000000597da1 in terminate_due_to_signal (sig=11, backtrace_limit=40) at emacs.c:383
> No locals.
> #10 0x00000000005c568e in handle_fatal_signal (sig=11) at sysdep.c:1772
> No locals.
> #11 0x00000000005c565f in deliver_thread_signal (sig=11, handler=0x5c5674 <handle_fatal_signal>) at sysdep.c:1746
>         old_errno = 22
> #12 0x00000000005c56c9 in deliver_fatal_thread_signal (sig=11) at sysdep.c:1784
> No locals.
> #13 0x00000000005c5885 in handle_sigsegv (sig=11, siginfo=0xe42f30 <sigsegv_stack+6896>, arg=0xe42e00 <sigsegv_stack+6592>) at sysdep.c:1869
>         fatal = true
> #14 <signal handler called>
> No locals.
> #15 0x000000000059173a in make_lisp_ptr (ptr=<error reading variable: Cannot access memory at address 0x7ffde7f3eff8>, 
>     type=<error reading variable: Cannot access memory at address 0x7ffde7f3eff4>) at lisp.h:1168
>         a = {i = 0x0}
> #16 0x000000000062b7fa in live_cons_holding (m=0x840e8d0, p=0x843a330) at alloc.c:4442
>         s = 0x843a330
>         b = 0x843a000
>         cp = 0x843a330 "C\243C\b"
>         offset = 816
> #17 0x000000000062b82c in live_cons_p (m=0x840e8d0, p=0x843a330) at alloc.c:4451
> No locals.
> #18 0x000000000062fb6c in mark_object (arg=...) at alloc.c:6468
>         ptr = 0x843a330
>         obj = {i = 0x843a333}
>         po = 0x843a330
>         m = 0x840e8d0
>         cdr_count = 0

IOW, GC segfaults, and then Emacs tries to auto-save the session,
which fails.

Is it possible that GC hits a stack overflow?  Can you try manually
establishing whether that is the case by doing what stack_overflow in
sysdep.c does?