Subject: bug#71176: 30.0.50; Segmentation fault (SIGSEGV) in TTY+emacsclient, default_face is nil

From: Daniel Clemente <[email-masked]>
Date: Sun, 26 May 2024 10:58:41 +0000

This was with the 1st patch (the one changing tty_lookup_color):

(gdb) p f->face_cache->used
$10 = 19
(gdb) p Vface_remapping_alist
$11 = XIL(0)
(gdb) p f->face_cache
$12 = (struct face_cache *) 0x555556281c10

Thanks for the patches.
With only the 3rd patch you sent (i.e. having removed the 1st patch), it
doesn't crash. Opening and closing frames works, and emacsclient is usable
even after what I describe below.
Normal usage seems also fine (defining "fine" as: I see another TTY-only
bug but it's unrelated). Using it with my full ~/.emacs also works.

However after around 1 minute of opening+killing frames with the bash
for-loop I mentioned, the C stack is much higher (see first backtrace
below).
If I let it continue (~3 minutes in total), it leads to: Lisp nesting
exceeds ‘max-lisp-eval-depth’: 1601. In "bt" I saw a stack of 21k function
calls.

Below the first "bt" I attach a fragment of "bt full" (from a different
run).
If just stay a few seconds opening+kill frames (not 1 minute), then stop,
it doesn't have such a high stack (see bt tagged bt222 below).

This may be a different bug; if you want I can report it separately.

I also tried this: move from the 2-week old commit I used (b82a003544c) to
latest HEAD (cfd654c4186), apply your patch (v3) on top, clean and
recompile. I still see the same thing happen.
It's not due to the fresh Emacs launching process for native compilation,
because it also happens after everything has been native-compiled.

(gdb) bt
#0  pselect64_syscall (sigmask=0x0, timeout=<optimized out>, exceptfds=0x0,
writefds=0x7ffffffc1c50, readfds=0x7ffffffc1cd0, nfds=11) at
../sysdeps/unix/sysv/linux/pselect.c:34
#1  __pselect (nfds=11, readfds=0x7ffffffc1cd0, writefds=0x7ffffffc1c50,
exceptfds=0x0, timeout=<optimized out>, sigmask=0x0) at
../sysdeps/unix/sysv/linux/pselect.c:56
#2  0x00005555557ddb77 in really_call_select (arg=0x7ffffffc1a10) at
thread.c:624
#3  0x00005555556fe72c in flush_stack_call_func1 (func=0x5555557ddadd
<really_call_select>, arg=0x7ffffffc1a10) at alloc.c:5534
#4  0x00005555557dcf94 in flush_stack_call_func (func=0x5555557ddadd
<really_call_select>, arg=0x7ffffffc1a10) at /w/emacs/src/lisp.h:4479
#5  0x00005555557ddc32 in thread_select (func=0x7ffff551d980 <__pselect>,
max_fds=11, rfds=0x7ffffffc1cd0, wfds=0x7ffffffc1c50, efds=0x0,
timeout=0x7ffffffc1c30, sigmask=0x0) at thread.c:656
#6  0x00005555557a7fe9 in wait_reading_process_output (time_limit=1,
nsecs=999990398, read_kbd=-1, do_display=true, wait_for_cell=XIL(0),
wait_proc=0x0, just_wait_proc=0) at process.c:5752
#7  0x0000555555677c1c in kbd_buffer_get_event (kbp=0x7ffffffc2008,
used_mouse_menu=0x0, end_time=0x7ffffffc2680) at keyboard.c:4057
#8  0x0000555555673d93 in read_event_from_main_queue
(end_time=0x7ffffffc2680, local_getcjmp=0x7ffffffc2450,
used_mouse_menu=0x0) at keyboard.c:2330
#9  0x0000555555674047 in read_decoded_event_from_main_queue
(end_time=0x7ffffffc2680, local_getcjmp=0x7ffffffc2450, prev_event=XIL(0),
used_mouse_menu=0x0) at keyboard.c:2394
#10 0x00005555556757f1 in read_char (commandflag=0, map=XIL(0),
prev_event=XIL(0), used_mouse_menu=0x0, end_time=0x7ffffffc2680) at
keyboard.c:3015
#11 0x000055555576bd6e in read_filtered_event (no_switch_frame=false,
ascii_required=false, error_nonascii=false, input_method=true,
seconds=make_fixnum(2)) at lread.c:848
#12 0x000055555576c0e0 in Fread_event (prompt=XIL(0),
inherit_input_method=XIL(0x30), seconds=make_fixnum(2)) at lread.c:998
#13 0x00007ffff17b6e9f in F7369742d666f72_sit_for_0 () from
/opt/dc/emacs/bin/../lib/emacs/30.0.50/native-lisp/30.0.50-bc425715/preloaded/subr-13adf6a6-abc03354.eln
#14 0x0000555555735e8c in funcall_subr (subr=0x7ffff193cc78, numargs=1,
args=0x7ffffffc28a8) at eval.c:3143
#15 0x00005555557358fa in funcall_general (fun=XIL(0x7ffff193cc7d),
numargs=1, args=0x7ffffffc28a8) at eval.c:3020
#16 0x0000555555735bab in Ffuncall (nargs=2, args=0x7ffffffc28a0) at
eval.c:3073
#17 0x00007ffff011f163 in
F7365727665722d72657475726e2d6572726f72_server_return_error_0 () from
/home/dc/.emacs.d/eln-cache/30.0.50-bc425715/server-0cc44189-48d76bed.eln
#18 0x0000555555735e8c in funcall_subr (subr=0x5555562637a8, numargs=2,
args=0x7ffffffc2a70) at eval.c:3143
#19 0x00005555557358fa in funcall_general (fun=XIL(0x5555562637ad),
numargs=2, args=0x7ffffffc2a70) at eval.c:3020
#20 0x0000555555735bab in Ffuncall (nargs=3, args=0x7ffffffc2a68) at
eval.c:3073
#21 0x00007ffff011bff8 in
F7365727665722d70726f636573732d66696c746572_server_process_filter_0 () from
/home/dc/.emacs.d/eln-cache/30.0.50-bc425715/server-0cc44189-48d76bed.eln
#22 0x0000555555735e8c in funcall_subr (subr=0x5555562901b0, numargs=2,
args=0x7ffffffc2cc8) at eval.c:3143
#23 0x00005555557358fa in funcall_general (fun=XIL(0x5555562901b5),
numargs=2, args=0x7ffffffc2cc8) at eval.c:3020
#24 0x0000555555735bab in Ffuncall (nargs=3, args=0x7ffffffc2cc0) at
eval.c:3073
#25 0x00005555557350ac in Fapply (nargs=2, args=0x7ffffffc2d70) at
eval.c:2745
#26 0x0000555555735657 in apply1 (fn=XIL(0x478bf0),
arg=XIL(0x7ffff01db5b3)) at eval.c:2961
#27 0x00005555557a8ee5 in read_process_output_call
(fun_and_args=XIL(0x7ffff01db5a3)) at process.c:6130
#28 0x000055555573227e in internal_condition_case_1 (bfun=0x5555557a8eae
<read_process_output_call>, arg=XIL(0x7ffff01db5a3), handlers=XIL(0x90),
hfun=0x5555557a8eeb <read_process_output_error_handler>) at eval.c:1617
#29 0x00005555557a97fd in read_and_dispose_of_process_output
(p=0x555556552c10,
    chars=0x7ffffffc2e90 "-env MAIL=/var/mail/dc -env LANGUAGE=en_US:en
-env GTK_CSD=0 -env WORKON_HOME=/home/dc/.virtualenvs -env USER=dc -env
XDG_SEAT=seat0 -env VAGRANT_DISABLE_VBOXSYMLINKCREATE=1 -env
SSH_AGENT_PID=1016 -e"...,
    nbytes=3745, coding=0x55555629a880) at process.c:6354
#30 0x00005555557a9409 in read_process_output (proc=XIL(0x555556552c15),
channel=6) at process.c:6264
#31 0x00005555557a8689 in wait_reading_process_output (time_limit=1,
nsecs=999991287, read_kbd=-1, do_display=true, wait_for_cell=XIL(0),
wait_proc=0x0, just_wait_proc=0) at process.c:5948
#32 0x0000555555677c1c in kbd_buffer_get_event (kbp=0x7ffffffc4518,
used_mouse_menu=0x0, end_time=0x7ffffffc4b90) at keyboard.c:4057
#33 0x0000555555673d93 in read_event_from_main_queue
(end_time=0x7ffffffc4b90, local_getcjmp=0x7ffffffc4960,
used_mouse_menu=0x0) at keyboard.c:2330
#34 0x0000555555674047 in read_decoded_event_from_main_queue
(end_time=0x7ffffffc4b90, local_getcjmp=0x7ffffffc4960, prev_event=XIL(0),
used_mouse_menu=0x0) at keyboard.c:2394
#35 0x00005555556757f1 in read_char (commandflag=0, map=XIL(0),
prev_event=XIL(0), used_mouse_menu=0x0, end_time=0x7ffffffc4b90) at
keyboard.c:3015
#36 0x000055555576bd6e in read_filtered_event (no_switch_frame=false,
ascii_required=false, error_nonascii=false, input_method=true,
seconds=make_fixnum(2)) at lread.c:848
#37 0x000055555576c0e0 in Fread_event (prompt=XIL(0),
inherit_input_method=XIL(0x30), seconds=make_fixnum(2)) at lread.c:998
#38 0x00007ffff17b6e9f in F7369742d666f72_sit_for_0 () from
/opt/dc/emacs/bin/../lib/emacs/30.0.50/native-lisp/30.0.50-bc425715/preloaded/subr-13adf6a6-abc03354.eln
#39 0x0000555555735e8c in funcall_subr (subr=0x7ffff193cc78, numargs=1,
args=0x7ffffffc4db8) at eval.c:3143
#40 0x00005555557358fa in funcall_general (fun=XIL(0x7ffff193cc7d),
numargs=1, args=0x7ffffffc4db8) at eval.c:3020
#41 0x0000555555735bab in Ffuncall (nargs=2, args=0x7ffffffc4db0) at
eval.c:3073
#42 0x00007ffff011f163 in
F7365727665722d72657475726e2d6572726f72_server_return_error_0 () from
/home/dc/.emacs.d/eln-cache/30.0.50-bc425715/server-0cc44189-48d76bed.eln
#43 0x0000555555735e8c in funcall_subr (subr=0x5555562637a8, numargs=2,
args=0x7ffffffc4f80) at eval.c:3143
#44 0x00005555557358fa in funcall_general (fun=XIL(0x5555562637ad),
numargs=2, args=0x7ffffffc4f80) at eval.c:3020
#45 0x0000555555735bab in Ffuncall (nargs=3, args=0x7ffffffc4f78) at
eval.c:3073
#46 0x00007ffff011bff8 in
F7365727665722d70726f636573732d66696c746572_server_process_filter_0 () from
/home/dc/.emacs.d/eln-cache/30.0.50-bc425715/server-0cc44189-48d76bed.eln
#47 0x0000555555735e8c in funcall_subr (subr=0x5555562901b0, numargs=2,
args=0x7ffffffc51d8) at eval.c:3143
#48 0x00005555557358fa in funcall_general (fun=XIL(0x5555562901b5),
numargs=2, args=0x7ffffffc51d8) at eval.c:3020
#49 0x0000555555735bab in Ffuncall (nargs=3, args=0x7ffffffc51d0) at
eval.c:3073
#50 0x00005555557350ac in Fapply (nargs=2, args=0x7ffffffc5280) at
eval.c:2745
#51 0x0000555555735657 in apply1 (fn=XIL(0x478bf0),
arg=XIL(0x7ffff01dd6c3)) at eval.c:2961
#52 0x00005555557a8ee5 in read_process_output_call
(fun_and_args=XIL(0x7ffff01dd6b3)) at process.c:6130
#53 0x000055555573227e in internal_condition_case_1 (bfun=0x5555557a8eae
<read_process_output_call>, arg=XIL(0x7ffff01dd6b3), handlers=XIL(0x90),
hfun=0x5555557a8eeb <read_process_output_error_handler>) at eval.c:1617
#54 0x00005555557a97fd in read_and_dispose_of_process_output
(p=0x5555564c9658,
    chars=0x7ffffffc53a0 "-env MAIL=/var/mail/dc -env LANGUAGE=en_US:en
-env GTK_CSD=0 -env WORKON_HOME=/home/dc/.virtualenvs -env USER=dc -env
XDG_SEAT=seat0 -env VAGRANT_DISABLE_VBOXSYMLINKCREATE=1 -env
SSH_AGENT_PID=1016 -e"...,
    nbytes=3745, coding=0x55555626b590) at process.c:6354
#55 0x00005555557a9409 in read_process_output (proc=XIL(0x5555564c965d),
channel=5) at process.c:6264
#56 0x00005555557a8689 in wait_reading_process_output (time_limit=1,
nsecs=999990440, read_kbd=-1, do_display=true, wait_for_cell=XIL(0),
wait_proc=0x0, just_wait_proc=0) at process.c:5948
#57 0x0000555555677c1c in kbd_buffer_get_event (kbp=0x7ffffffc6a28,
used_mouse_menu=0x0, end_time=0x7ffffffc70a0) at keyboard.c:4057
#58 0x0000555555673d93 in read_event_from_main_queue
(end_time=0x7ffffffc70a0, local_getcjmp=0x7ffffffc6e70,
used_mouse_menu=0x0) at keyboard.c:2330
#59 0x0000555555674047 in read_decoded_event_from_main_queue
(end_time=0x7ffffffc70a0, local_getcjmp=0x7ffffffc6e70, prev_event=XIL(0),
used_mouse_menu=0x0) at keyboard.c:2394
#60 0x00005555556757f1 in read_char (commandflag=0, map=XIL(0),
prev_event=XIL(0), used_mouse_menu=0x0, end_time=0x7ffffffc70a0) at
keyboard.c:3015
#61 0x000055555576bd6e in read_filtered_event (no_switch_frame=false,
ascii_required=false, error_nonascii=false, input_method=true,
seconds=make_fixnum(2)) at lread.c:848
--Type <RET> for more, q to quit, c to continue without paging--
#62 0x000055555576c0e0 in Fread_event (prompt=XIL(0),
inherit_input_method=XIL(0x30), seconds=make_fixnum(2)) at lread.c:998
#63 0x00007ffff17b6e9f in F7369742d666f72_sit_for_0 () from
/opt/dc/emacs/bin/../lib/emacs/30.0.50/native-lisp/30.0.50-bc425715/preloaded/subr-13adf6a6-abc03354.eln
#64 0x0000555555735e8c in funcall_subr (subr=0x7ffff193cc78, numargs=1,
args=0x7ffffffc72c8) at eval.c:3143
#65 0x00005555557358fa in funcall_general (fun=XIL(0x7ffff193cc7d),
numargs=1, args=0x7ffffffc72c8) at eval.c:3020
#66 0x0000555555735bab in Ffuncall (nargs=2, args=0x7ffffffc72c0) at
eval.c:3073
#67 0x00007ffff011f163 in
F7365727665722d72657475726e2d6572726f72_server_return_error_0 () from
/home/dc/.emacs.d/eln-cache/30.0.50-bc425715/server-0cc44189-48d76bed.eln
#68 0x0000555555735e8c in funcall_subr (subr=0x5555562637a8, numargs=2,
args=0x7ffffffc7490) at eval.c:3143
#69 0x00005555557358fa in funcall_general (fun=XIL(0x5555562637ad),
numargs=2, args=0x7ffffffc7490) at eval.c:3020
#70 0x0000555555735bab in Ffuncall (nargs=3, args=0x7ffffffc7488) at
eval.c:3073
#71 0x00007ffff011bff8 in
F7365727665722d70726f636573732d66696c746572_server_process_filter_0 () from
/home/dc/.emacs.d/eln-cache/30.0.50-bc425715/server-0cc44189-48d76bed.eln
#72 0x0000555555735e8c in funcall_subr (subr=0x5555562901b0, numargs=2,
args=0x7ffffffc76e8) at eval.c:3143
#73 0x00005555557358fa in funcall_general (fun=XIL(0x5555562901b5),
numargs=2, args=0x7ffffffc76e8) at eval.c:3020
#74 0x0000555555735bab in Ffuncall (nargs=3, args=0x7ffffffc76e0) at
eval.c:3073
#75 0x00005555557350ac in Fapply (nargs=2, args=0x7ffffffc7790) at
eval.c:2745
#76 0x0000555555735657 in apply1 (fn=XIL(0x478bf0),
arg=XIL(0x7ffff01deb83)) at eval.c:2961
#77 0x00005555557a8ee5 in read_process_output_call
(fun_and_args=XIL(0x7ffff01deb73)) at process.c:6130
#78 0x000055555573227e in internal_condition_case_1 (bfun=0x5555557a8eae
<read_process_output_call>, arg=XIL(0x7ffff01deb73), handlers=XIL(0x90),
hfun=0x5555557a8eeb <read_process_output_error_handler>) at eval.c:1617
#79 0x00005555557a97fd in read_and_dispose_of_process_output
(p=0x5555564c94d0,
    chars=0x7ffffffc78b0 "-env MAIL=/var/mail/dc -env LANGUAGE=en_US:en
-env GTK_CSD=0 -env WORKON_HOME=/home/dc/.virtualenvs -env USER=dc -env
XDG_SEAT=seat0 -env VAGRANT_DISABLE_VBOXSYMLINKCREATE=1 -env
SSH_AGENT_PID=1016 -e"...,
    nbytes=3745, coding=0x55555629a880) at process.c:6354
#80 0x00005555557a9409 in read_process_output (proc=XIL(0x5555564c94d5),
channel=6) at process.c:6264
#81 0x00005555557a8689 in wait_reading_process_output (time_limit=1,
nsecs=999989706, read_kbd=-1, do_display=true, wait_for_cell=XIL(0),
wait_proc=0x0, just_wait_proc=0) at process.c:5948
[…]
#643 0x00005555557358fa in funcall_general (fun=XIL(0x5555562901b5),
numargs=2, args=0x7fffffffb7c8) at eval.c:3020
#644 0x0000555555735bab in Ffuncall (nargs=3, args=0x7fffffffb7c0) at
eval.c:3073
#645 0x00005555557350ac in Fapply (nargs=2, args=0x7fffffffb870) at
eval.c:2745
#646 0x0000555555735657 in apply1 (fn=XIL(0x478bf0),
arg=XIL(0x7ffff03ce783)) at eval.c:2961
#647 0x00005555557a8ee5 in read_process_output_call
(fun_and_args=XIL(0x7ffff03ce773)) at process.c:6130
#648 0x000055555573227e in internal_condition_case_1 (bfun=0x5555557a8eae
<read_process_output_call>, arg=XIL(0x7ffff03ce773), handlers=XIL(0x90),
hfun=0x5555557a8eeb <read_process_output_error_handler>) at eval.c:1617
#649 0x00005555557a97fd in read_and_dispose_of_process_output
(p=0x5555562bebe8,
    chars=0x7fffffffb990 "-env MAIL=/var/mail/dc -env LANGUAGE=en_US:en
-env GTK_CSD=0 -env WORKON_HOME=/home/dc/.virtualenvs -env USER=dc -env
XDG_SEAT=seat0 -env VAGRANT_DISABLE_VBOXSYMLINKCREATE=1 -env
SSH_AGENT_PID=1016 -e"...,
    nbytes=3745, coding=0x55555627e980) at process.c:6354
#650 0x00005555557a9409 in read_process_output (proc=XIL(0x5555562bebed),
channel=9) at process.c:6264
#651 0x00005555557a8689 in wait_reading_process_output (time_limit=0,
nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=XIL(0), wait_proc=0x0,
just_wait_proc=0) at process.c:5948
#652 0x0000555555677daf in kbd_buffer_get_event (kbp=0x7fffffffd018,
used_mouse_menu=0x7fffffffd69f, end_time=0x0) at keyboard.c:4078
#653 0x0000555555673d93 in read_event_from_main_queue (end_time=0x0,
local_getcjmp=0x7fffffffd460, used_mouse_menu=0x7fffffffd69f) at
keyboard.c:2330
#654 0x0000555555674047 in read_decoded_event_from_main_queue
(end_time=0x0, local_getcjmp=0x7fffffffd460, prev_event=XIL(0),
used_mouse_menu=0x7fffffffd69f) at keyboard.c:2394
#655 0x00005555556757f1 in read_char (commandflag=1,
map=XIL(0x7ffff01ce653), prev_event=XIL(0), used_mouse_menu=0x7fffffffd69f,
end_time=0x0) at keyboard.c:3015
#656 0x0000555555685208 in read_key_sequence (keybuf=0x7fffffffd8b0,
prompt=XIL(0), dont_downcase_last=false, can_return_switch_frame=true,
fix_current_buffer=true, prevent_redisplay=false,
disable_text_conversion_p=false)
    at keyboard.c:10723
#657 0x00005555556716f3 in command_loop_1 () at keyboard.c:1429
#658 0x00005555557321d7 in internal_condition_case (bfun=0x555555671300
<command_loop_1>, handlers=XIL(0x90), hfun=0x5555556708a2 <cmd_error>) at
eval.c:1593
#659 0x0000555555670f5d in command_loop_2 (handlers=XIL(0x90)) at
keyboard.c:1168
#660 0x00005555557316de in internal_catch (tag=XIL(0xe880),
func=0x555555670f33 <command_loop_2>, arg=XIL(0x90)) at eval.c:1272
#661 0x0000555555670eef in command_loop () at keyboard.c:1146
#662 0x0000555555670444 in recursive_edit_1 () at keyboard.c:754
#663 0x00005555556705f0 in Frecursive_edit () at keyboard.c:837
#664 0x000055555566cae2 in main (argc=2, argv=0x7fffffffded8) at
emacs.c:2621
(gdb)

#14 0x00005555557a8f0d in read_process_output_error_handler
(error_val=XIL(0x5555571f0b53))
    at process.c:6136
No locals.
#15 0x000055555573226f in internal_condition_case_1 (bfun=0x5555557a8eae
<read_process_output_call>,
    arg=XIL(0x5555571f0b33), handlers=XIL(0x90), hfun=0x5555557a8eeb
<read_process_output_error_handler>)
    at eval.c:1613
        val = XIL(0x5555571f0b53)
        c = 0x5555569f2910
#16 0x00005555557a97fd in read_and_dispose_of_process_output
(p=0x5555572d0840,
    chars=0x7fffff675860 "-env MAIL=/var/mail/dc -env LANGUAGE=en_US:en
-env GTK_CSD=0 -env WORKON_HOME=/home/dc/.virtualenvs -env USER=dc -env
XDG_SEAT=seat0 -env VAGRANT_DISABLE_VBOXSYMLINKCREATE=1 -env
SSH_AGENT_PID=1016 -e"..., nbytes=3745, coding=0x555556273360) at
process.c:6354
        outstream = XIL(0x478bf0)
        text = XIL(0x5555572ce7b4)
        outer_running_asynch_code = true
        waiting = 0
#17 0x00005555557a9409 in read_process_output (proc=XIL(0x5555572d0845),
channel=6) at process.c:6264
        nbytes = 3745
        p = 0x5555572d0840
--Type <RET> for more, q to quit, c to continue without paging--
        coding = 0x555556273360
        carryover = 0
        readmax = 4096
        count = {
          bytes = 391360
        }
        odeactivate = XIL(0)
        chars = 0x7fffff675860 "-env MAIL=/var/mail/dc -env
LANGUAGE=en_US:en -env GTK_CSD=0 -env WORKON_HOME=/home/dc/.virtualenvs
-env USER=dc -env XDG_SEAT=seat0 -env VAGRANT_DISABLE_VBOXSYMLINKCREATE=1
-env SSH_AGENT_PID=1016 -e"...
        sa_avail = 12224
        sa_count = {
          bytes = 391360
        }
#18 0x00005555557a8689 in wait_reading_process_output (time_limit=1,
nsecs=0, read_kbd=0,
    do_display=false, wait_for_cell=XIL(0), wait_proc=0x0,
just_wait_proc=0) at process.c:5948
        nread = -9999152
        process_skipped = false
        wrapped = true
        channel_start = 8
        child_fd = 10
        last_read_channel = 7
        channel = 6
        nfds = 1
        Available = {
          fds_bits = {64, 0 <repeats 15 times>}
        }
        Writeok = {
          fds_bits = {0 <repeats 16 times>}
        }
        check_write = true
        check_delay = 0
        no_avail = false
        xerrno = 32
        proc = XIL(0x5555572d0845)
        timeout = {
          tv_sec = 1,
          tv_nsec = 0
        }
        end_time = {
          tv_sec = 1716714406,
          tv_nsec = 320031846
        }
        timer_delay = {
          tv_sec = 0,
          tv_nsec = -1
        }
        got_output_end_time = {
          tv_sec = 0,
          tv_nsec = -1
        }
        MINIMUM = MINIMUM
        TIMEOUT = TIMEOUT
        FOREVER = FOREVER
        wait = TIMEOUT
        got_some_output = -1
        prev_wait_proc_nbytes_read = 0
        retry_for_async = false
        count = {
          bytes = 391328
        }
        now = {
          tv_sec = 0,
          tv_nsec = -1
--Type <RET> for more, q to quit, c to continue without paging--
        }
#19 0x000055555559153e in Fsleep_for (seconds=make_fixnum(1),
milliseconds=XIL(0)) at dispnew.c:6231
        t = {
          tv_sec = 1,
          tv_nsec = 0
        }
        tend = {
          tv_sec = 1716714406,
          tv_nsec = 320031119
        }
        duration = 1
#20 0x00005555557ac09b in exec_sentinel_error_handler
(error_val=XIL(0x5555571f0543)) at process.c:7619
No locals.
#21 0x000055555573226f in internal_condition_case_1 (bfun=0x5555557a8eae
<read_process_output_call>,
    arg=XIL(0x5555571f0523), handlers=XIL(0x90), hfun=0x5555557abffa
<exec_sentinel_error_handler>)
    at eval.c:1613
        val = XIL(0x5555571f0543)
        c = 0x5555569f2910
#22 0x00005555557ac230 in exec_sentinel (proc=XIL(0x5555572d0845),
reason=XIL(0x5555572cc454))
    at process.c:7669
        sentinel = XIL(0x478bc0)
        odeactivate = XIL(0)
        p = 0x5555572d0840
        count = {
          bytes = 391200
        }
        outer_running_asynch_code = true
        waiting = 0
#23 0x00005555557a6bde in server_accept_connection
(server=XIL(0x5555562642ad), channel=4)
    at process.c:5115
        buffer = XIL(0)
        contact = XIL(0x5555571f02e3)
        host = XIL(0x30)
        service = XIL(0)
        ps = 0x5555562642a8
        p = 0x5555572d0840
        s = 6
        saddr = {
          sa = {
            sa_family = 1,
            sa_data = "/run/user/1000"
          },
          in = {
            sin_family = 1,
            sin_port = 29231,
            sin_addr = {
              s_addr = 1966042741
            },
            sin_zero = "ser/1000"
          },
          in6 = {
            sin6_family = 1,
            sin6_port = 29231,
            sin6_flowinfo = 1966042741,
            sin6_addr = {
              __in6_u = {
                __u6_addr8 = "ser/1000/emacs/s",
                __u6_addr16 = {25971, 12146, 12337, 12336, 25903, 24941,
29539, 29487},
                __u6_addr32 = {796026227, 808464433, 1634559279, 1932489571}
              }
            },
            sin6_scope_id = 1702261349
          },
          un = {
--Type <RET> for more, q to quit, c to continue without paging--
            sun_family = 1,
            sun_path =
"/run/user/1000/emacs/server\000\000\000\240\303\324UUU\000\000pqg\377\377\177\000\000\340pg\377\377\177\000\000,\347oUUU\000\000pqg\377\377\177\000\000\335\332}UUU",
'\000' <repeats 18 times>, "\340pg\377\377\177\000\000\240\303\324UUU"
          }
        }
        len = 30
        count = {
          bytes = 391200
        }
        args = {XIL(0x7fffff676f64), XIL(0x55555623b864),
make_fixnum(1967), XIL(0), XIL(0x103e0),
          XIL(0x7ffff2142950), XIL(0x7ffff1ab10c8), XIL(0x7ffff1ab10c8),
XIL(0x555555dddde0), XIL(0x60),
          XIL(0x5555571f02b3)}
        nargs = 3
        host_format_in = XIL(0x7fffff676fe4)
        host_format_in6 = XIL(0x7fffff676fc4)
        procname_format_in = XIL(0x7fffff676fa4)
        procname_format_in6 = XIL(0x7fffff676f84)
        procname_format_default = XIL(0x7fffff676f64)
        name = XIL(0x5555572cc414)
        proc = XIL(0x5555572d0845)
        dash = XIL(0x7fffff676f44)
        nl = XIL(0x7fffff676f24)
        host_string = XIL(0x7fffff676f44)
        open_from = XIL(0x7fffff676f04)
#24 0x00005555557a8670 in wait_reading_process_output (time_limit=1,
nsecs=0, read_kbd=0,
    do_display=false, wait_for_cell=XIL(0), wait_proc=0x0,
just_wait_proc=0) at process.c:5941
        nread = -9996976
        process_skipped = false
        wrapped = true
        channel_start = 8
        child_fd = 10
        last_read_channel = 7
        channel = 4
        nfds = 1
        Available = {
          fds_bits = {16, 0 <repeats 15 times>}
        }
        Writeok = {
          fds_bits = {0 <repeats 16 times>}
        }
        check_write = true
        check_delay = 0
        no_avail = false
        xerrno = 32
        proc = XIL(0x5555562642ad)
        timeout = {
          tv_sec = 1,
          tv_nsec = 0
        }
        end_time = {
          tv_sec = 1716714406,
          tv_nsec = 249332210
        }
        timer_delay = {
          tv_sec = 0,
          tv_nsec = -1
        }
        got_output_end_time = {
          tv_sec = 0,
          tv_nsec = -1
        }
        MINIMUM = MINIMUM
        TIMEOUT = TIMEOUT
--Type <RET> for more, q to quit, c to continue without paging--
        FOREVER = FOREVER
        wait = TIMEOUT
        got_some_output = -1
        prev_wait_proc_nbytes_read = 0
        retry_for_async = false
        count = {
          bytes = 391168
        }
        now = {
          tv_sec = 0,
          tv_nsec = -1
        }
#25 0x000055555559153e in Fsleep_for (seconds=make_fixnum(1),
milliseconds=XIL(0)) at dispnew.c:6231
        t = {
          tv_sec = 1,
          tv_nsec = 0
        }
        tend = {
          tv_sec = 1716714406,
          tv_nsec = 249331706
        }
        duration = 1
#26 0x00005555557a8f5e in read_process_output_error_handler
(error_val=XIL(0x5555571ffc43))
    at process.c:6140
No locals.
#27 0x000055555573226f in internal_condition_case_1 (bfun=0x5555557a8eae
<read_process_output_call>,
    arg=XIL(0x5555571ffc23), handlers=XIL(0x90), hfun=0x5555557a8eeb
<read_process_output_error_handler>)
    at eval.c:1613
        val = XIL(0x5555571ffc43)
        c = 0x5555569f2910
#28 0x00005555557a97fd in read_and_dispose_of_process_output
(p=0x5555572b7268,
    chars=0x7fffff677730 "-env MAIL=/var/mail/dc -env LANGUAGE=en_US:en
-env GTK_CSD=0 -env WORKON_HOME=/home/dc/.virtualenvs -env USER=dc -env
XDG_SEAT=seat0 -env VAGRANT_DISABLE_VBOXSYMLINKCREATE=1 -env
SSH_AGENT_PID=1016 -e"..., nbytes=3744, coding=0x55555626b590) at
process.c:6354
        outstream = XIL(0x478bf0)
        text = XIL(0x5555572cc234)
        outer_running_asynch_code = true
        waiting = 0
#29 0x00005555557a9409 in read_process_output (proc=XIL(0x5555572b726d),
channel=5) at process.c:6264
        nbytes = 3744
        p = 0x5555572b7268
        coding = 0x55555626b590
        carryover = 0
        readmax = 4096
        count = {
          bytes = 391040
        }
        odeactivate = XIL(0)
        chars = 0x7fffff677730 "-env MAIL=/var/mail/dc -env
LANGUAGE=en_US:en -env GTK_CSD=0 -env WORKON_HOME=/home/dc/.virtualenvs
-env USER=dc -env XDG_SEAT=seat0 -env VAGRANT_DISABLE_VBOXSYMLINKCREATE=1
-env SSH_AGENT_PID=1016 -e"...
        sa_avail = 12224
        sa_count = {
          bytes = 391040
        }

bt222: bt after opening+killing frames for just a few seconds (not 1
minute):

(gdb) bt
#0  pselect64_syscall (sigmask=0x0, timeout=<optimized out>, exceptfds=0x0,
writefds=0x7fffffffcc60, readfds=0x7fffffffcce0, nfds=11) at
../sysdeps/unix/sysv/linux/pselect.c:34
#1  __pselect (nfds=11, readfds=0x7fffffffcce0, writefds=0x7fffffffcc60,
exceptfds=0x0, timeout=<optimized out>, sigmask=0x0) at
../sysdeps/unix/sysv/linux/pselect.c:56
#2  0x00005555557de8a5 in really_call_select (arg=0x7fffffffca20) at
thread.c:624
#3  0x00005555556ff4da in flush_stack_call_func1 (func=0x5555557de80b
<really_call_select>, arg=0x7fffffffca20) at alloc.c:5534
#4  0x00005555557ddcc2 in flush_stack_call_func (func=0x5555557de80b
<really_call_select>, arg=0x7fffffffca20) at /w/emacs/src/lisp.h:4507
#5  0x00005555557de960 in thread_select (func=0x7ffff551d980 <__pselect>,
max_fds=11, rfds=0x7fffffffcce0, wfds=0x7fffffffcc60, efds=0x0,
timeout=0x7fffffffcc40, sigmask=0x0) at thread.c:656
#6  0x00005555557a8e97 in wait_reading_process_output (time_limit=0,
nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=XIL(0), wait_proc=0x0,
just_wait_proc=0) at process.c:5752
#7  0x0000555555678c9f in kbd_buffer_get_event (kbp=0x7fffffffd018,
used_mouse_menu=0x7fffffffd69f, end_time=0x0) at keyboard.c:4079
#8  0x0000555555674c83 in read_event_from_main_queue (end_time=0x0,
local_getcjmp=0x7fffffffd460, used_mouse_menu=0x7fffffffd69f) at
keyboard.c:2330
#9  0x0000555555674f37 in read_decoded_event_from_main_queue (end_time=0x0,
local_getcjmp=0x7fffffffd460, prev_event=XIL(0),
used_mouse_menu=0x7fffffffd69f) at keyboard.c:2394
#10 0x00005555556766e1 in read_char (commandflag=1,
map=XIL(0x5555590fe183), prev_event=XIL(0), used_mouse_menu=0x7fffffffd69f,
end_time=0x0) at keyboard.c:3015
#11 0x00005555556860ee in read_key_sequence (keybuf=0x7fffffffd8b0,
prompt=XIL(0), dont_downcase_last=false, can_return_switch_frame=true,
fix_current_buffer=true, prevent_redisplay=false,
disable_text_conversion_p=false)
    at keyboard.c:10728
#12 0x00005555556725e8 in command_loop_1 () at keyboard.c:1429
#13 0x0000555555732f42 in internal_condition_case (bfun=0x5555556721f5
<command_loop_1>, handlers=XIL(0x90), hfun=0x555555671797 <cmd_error>) at
eval.c:1613
#14 0x0000555555671e52 in command_loop_2 (handlers=XIL(0x90)) at
keyboard.c:1168
#15 0x0000555555732449 in internal_catch (tag=XIL(0xfc60),
func=0x555555671e28 <command_loop_2>, arg=XIL(0x90)) at eval.c:1292
#16 0x0000555555671de4 in command_loop () at keyboard.c:1146
#17 0x0000555555671339 in recursive_edit_1 () at keyboard.c:754
#18 0x00005555556714e5 in Frecursive_edit () at keyboard.c:837
#19 0x000055555566d9dc in main (argc=2, argv=0x7fffffffded8) at emacs.c:2621