Eli Zaretskii writes: >> From: Simon Pugnet >> Cc: 61940@debbugs.gnu.org >> Date: Fri, 03 Mar 2023 16:38:00 +0000 >> >> > I'm not sure I understand what you mean by "attaching to a >> > running >> > instance of Emacs which crashed". If Emacs crashed, then it no >> > longer >> > is running, so what exactly happens when Emacs "crashes", and how >> > do >> > you attach GDB to such a "crashed" session? >> >> I used `gdb --pid=PID' to attach to the process which had crashed >> (or >> was at least not redrawing or accepting any user input). > > This seems to indicate that Emacs didn't crash, but stop responding > for some reason. In which case the backtrace you show doesn't tell > anything interesting, it just tells us that Emacs is waiting for > input. Sorry, yes I realise now that I said "crash" in the subject but I meant that it hung or stopped responding to input. What I see when this happens is a plain white frame (background colour of the theme) and no keyboard or mouse input seems to be accepted. >> From there I obtained the backtrace and was able to step, which is >> how I noticed that it seemed to be in a loop. I might have >> diagnosed >> this incorrectly however. > > The file etc/DEBUG in the Emacs repository has instructions for how > to > identify the code in which Emacs is looping, if it's looping. Look > for "If the symptom of the bug is that Emacs fails to respond". I managed to trigger this situation again this morning while working. Unfortunately I was unable to trigger it while it was being debugged in gdb; the problem occurs rarely so it's not easy to reproduce on demand. I tried sending a SIGUSR2 signal to the running process multiple times but this did not appear to have any effect. I again attached to the running process with gdb and ran "thread apply all bt" as instructed, here's the output: - Thread 5 (Thread 0x7f11d37fe6c0 (LWP 35081) "threaded-ml"): #0 0x00007f11e8d139df in poll () at /usr/lib/libc.so.6 #1 0x00007f11e051f8c7 in () at /usr/lib/libpulse.so.0 #2 0x00007f11e050946c in pa_mainloop_poll () at /usr/lib/libpulse.so.0 #3 0x00007f11e051342c in pa_mainloop_iterate () at /usr/lib/libpulse.so.0 #4 0x00007f11e05134e1 in pa_mainloop_run () at /usr/lib/libpulse.so.0 #5 0x00007f11e0523c02 in () at /usr/lib/libpulse.so.0 #6 0x00007f11e04c0c57 in () at /usr/lib/pulseaudio/libpulsecommon-16.1.so #7 0x00007f11e8c9ebb5 in () at /usr/lib/libc.so.6 #8 0x00007f11e8d20d90 in () at /usr/lib/libc.so.6 Thread 4 (Thread 0x7f11e23756c0 (LWP 35076) "dconf worker"): #0 0x00007f11e8d139df in poll () at /usr/lib/libc.so.6 #1 0x00007f11ec662c2f in () at /usr/lib/libglib-2.0.so.0 #2 0x00007f11ec60a0e2 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #3 0x00007f11e23cefde in () at /usr/lib/gio/modules/libdconfsettings.so #4 0x00007f11ec638db5 in () at /usr/lib/libglib-2.0.so.0 #5 0x00007f11e8c9ebb5 in () at /usr/lib/libc.so.6 #6 0x00007f11e8d20d90 in () at /usr/lib/libc.so.6 Thread 3 (Thread 0x7f11e2bf96c0 (LWP 35075) "gdbus"): #0 0x00007f11e8d139df in poll () at /usr/lib/libc.so.6 #1 0x00007f11ec662c2f in () at /usr/lib/libglib-2.0.so.0 #2 0x00007f11ec60ad8f in g_main_loop_run () at /usr/lib/libglib-2.0.so.0 #3 0x00007f11ec860aec in () at /usr/lib/libgio-2.0.so.0 #4 0x00007f11ec638db5 in () at /usr/lib/libglib-2.0.so.0 #5 0x00007f11e8c9ebb5 in () at /usr/lib/libc.so.6 #6 0x00007f11e8d20d90 in () at /usr/lib/libc.so.6 Thread 2 (Thread 0x7f11e33fa6c0 (LWP 35074) "gmain"): #0 0x00007f11e8d139df in poll () at /usr/lib/libc.so.6 #1 0x00007f11ec662c2f in () at /usr/lib/libglib-2.0.so.0 #2 0x00007f11ec60a0e2 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #3 0x00007f11ec60a132 in () at /usr/lib/libglib-2.0.so.0 #4 0x00007f11ec638db5 in () at /usr/lib/libglib-2.0.so.0 #5 0x00007f11e8c9ebb5 in () at /usr/lib/libc.so.6 #6 0x00007f11e8d20d90 in () at /usr/lib/libc.so.6 Thread 1 (Thread 0x7f11e55fa2c0 (LWP 35073) "emacs"): #0 0x00007f11e8d139df in poll () at /usr/lib/libc.so.6 #1 0x00007f11ec43726b in () at /usr/lib/libxcb.so.1 #2 0x00007f11ec438d1d in xcb_wait_for_event () at /usr/lib/libxcb.so.1 #3 0x00007f11ec49ab09 in _XReadEvents () at /usr/lib/libX11.so.6 #4 0x00007f11ec48143a in XIfEvent () at /usr/lib/libX11.so.6 #5 0x00007f11ec4c7f10 in () at /usr/lib/libX11.so.6 #6 0x00007f11ec4bf523 in () at /usr/lib/libX11.so.6 #7 0x00007f11ec4c847c in _XimRead () at /usr/lib/libX11.so.6 #8 0x00007f11ec4b8d6c in () at /usr/lib/libX11.so.6 #9 0x00007f11ec4a3c5f in XSetICValues () at /usr/lib/libX11.so.6 #10 0x0000563eb62f9d0b in xic_set_preeditarea (w=0x563ec43bdc60, x=287, y=493) at xfns.c:3176 #11 0x0000563eb62e5194 in handle_one_xevent (dpyinfo=dpyinfo@entry=0x563eb8c67800, event=event@entry=0x7ffce40dc7e0, finish=finish@entry=0x563eb6994270 , hold_quit=0x7ffce40dcac0) at xterm.c:20116 #12 0x0000563eb62ecec1 in event_handler_gdk (gxev=0x7ffce40dc7e0, ev=, data=) at xterm.c:17447 #13 0x00007f11ed4d1b0f in () at /usr/lib/libgdk-3.so.0 #14 0x00007f11ed4d96d5 in () at /usr/lib/libgdk-3.so.0 #15 0x00007f11ed47f029 in gdk_display_get_event () at /usr/lib/libgdk-3.so.0 #16 0x00007f11ed4d9a68 in () at /usr/lib/libgdk-3.so.0 #17 0x00007f11ec60b82b in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0 #18 0x00007f11ec662cc9 in () at /usr/lib/libglib-2.0.so.0 #19 0x00007f11ec60a0e2 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0 #20 0x00007f11ecdd8eeb in gtk_main_iteration () at /usr/lib/libgtk-3.so.0 #21 0x0000563eb62d783a in XTread_socket (terminal=, hold_quit=0x7ffce40dcac0) at xterm.c:24819 #22 0x0000563eb6322f61 in gobble_input () at keyboard.c:7417 #23 0x0000563eb6323335 in handle_async_input () at keyboard.c:7648 #24 process_pending_signals () at keyboard.c:7662 #25 0x0000563eb63ac12d in probably_quit () at eval.c:1661 #26 0x0000563eb63c0a50 in maybe_quit () at /storage/Work/personal/emacs/src/lisp.h:3689 #27 Fassoc (key=0x7f11e4b9eb0c, alist=0x7f11e501828b, testfn=0x0) at fns.c:1969 #28 0x0000563eb6338ab4 in silly_event_symbol_error (c=0xb6d0) at keymap.c:1476 #29 Fdefine_key (keymap=0x563ebcc2ab53, key=0x563eb91ea1f5, def=0x563ebc515d0d, remove=0x0) at keymap.c:1165 #30 0x00007f11d11835c8 in F666c796d616b652d2d6d6f64652d6c696e652d636f756e746572_flymake__mode_line_counter_0 () at /home/simon/.emacs.d/eln-cache/29.0.60-eff26154/flymake-a41dd277-ddccfc08.eln #31 0x0000563eb63b0247 in eval_sub (form=form@entry=0x563ebb1208c3) at eval.c:2501 #32 0x0000563eb63b2876 in Feval (form=0x563ebb1208c3, lexical=) at eval.c:2361 #33 0x0000563eb63ac3b6 in Ffuncall (nargs=nargs@entry=2, args=args@entry=0x7ffce40dcfc0) at eval.c:2995 #34 0x0000563eb63aace1 in internal_condition_case_n (bfun=0x563eb63ac2c0 , nargs=nargs@entry=2, args=args@entry=0x7ffce40dcfc0, handlers=handlers@entry=0x30, hfun=hfun@entry=0x563eb621cb60 ) at eval.c:1558 #35 0x0000563eb6207ecb in safe__call (inhibit_quit=inhibit_quit@entry=true, nargs=nargs@entry=2, func=func@entry=0x6930, ap=ap@entry=0x7ffce40dd040) at xdisp.c:3024 #36 0x0000563eb6207ff0 in safe__call1 (inhibit_quit=inhibit_quit@entry=true, fn=fn@entry=0x6930) at xdisp.c:3060 #37 0x0000563eb62389a5 in safe__eval (sexpr=, inhibit_quit=true) at xdisp.c:3074 #38 display_mode_element (it=it@entry=0x7ffce40ddb50, depth=15, depth@entry=13, field_width=0, precision=precision@entry=-101, elt=0x563ebb1208b3, props=props@entry=0x7f11e4a9ac13, risky=false) at xdisp.c:27205 #39 0x0000563eb6238b21 in display_mode_element (it=it@entry=0x7ffce40ddb50, depth=13, depth@entry=12, field_width=field_width@entry=-8, precision=precision@entry=-100, elt=0x563ebb120ed3, props=0x7f11e4a9ac13, risky=) at /storage/Work/personal/emacs/src/lisp.h:754 #40 0x0000563eb62371ff in display_mode_element (it=it@entry=0x7ffce40ddb50, depth=12, depth@entry=10, field_width=-8, precision=precision@entry=-100, elt=0x563ebb120813, props=props@entry=0x7f11e4a9ac13, risky=false) at xdisp.c:27228 #41 0x0000563eb6238b21 in display_mode_element (it=it@entry=0x7ffce40ddb50, depth=10, depth@entry=7, field_width=0, precision=precision@entry=-92, elt=0x563ebb120e13, props=props@entry=0x7f11e4a9ac13, risky=) at /storage/Work/personal/emacs/src/lisp.h:754 #42 0x0000563eb6238b21 in display_mode_element (it=it@entry=0x7ffce40ddb50, depth=7, depth@entry=5, field_width=0, precision=precision@entry=-80, elt=0x563ebb405ed3, props=props@entry=0x7f11e4a9ac13, risky=) at /storage/Work/personal/emacs/src/lisp.h:754 #43 0x0000563eb6238b21 in display_mode_element (it=it@entry=0x7ffce40ddb50, depth=5, depth@entry=4, field_width=field_width@entry=0, precision=precision@entry=-80, elt=0x7f11e4a9aca3, props=0x7f11e4a9ac13, risky=) at /storage/Work/personal/emacs/src/lisp.h:754 #44 0x0000563eb62371ff in display_mode_element (it=it@entry=0x7ffce40ddb50, depth=4, depth@entry=3, field_width=0, precision=precision@entry=-80, elt=0x7f11e4a9abf3, props=props@entry=0x0, risky=false) at xdisp.c:27228 #45 0x0000563eb6238b21 in display_mode_element (it=it@entry=0x7ffce40ddb50, depth=3, depth@entry=1, field_width=0, precision=precision@entry=-76, elt=0x7f11e4a9a8ab, props=props@entry=0x0, risky=) at /storage/Work/personal/emacs/src/lisp.h:754 #46 0x0000563eb6238b21 in display_mode_element (it=it@entry=0x7ffce40ddb50, depth=1, depth@entry=0, field_width=field_width@entry=0, precision=precision@entry=0, elt=0x7f11e470fadb, elt@entry=0x7f11e470fa4b, props=props@entry=0x0, risky=) at /storage/Work/personal/emacs/src/lisp.h:754 #47 0x0000563eb623a620 in display_mode_line (w=w@entry=0x563ec43bdc60, face_id=MODE_LINE_ACTIVE_FACE_ID, format=0x7f11e470fa4b) at xdisp.c:26717 #48 0x0000563eb623c8ad in display_mode_lines (w=w@entry=0x563ec43bdc60) at xdisp.c:26630 #49 0x0000563eb6251d39 in redisplay_window (window=0x563ec43bdc65, just_this_one_p=just_this_one_p@entry=false) at xdisp.c:20364 #50 0x0000563eb6255a1b in redisplay_window_0 (window=window@entry=0x563ec43bdc65) at xdisp.c:17446 #51 0x0000563eb63aaad4 in internal_condition_case_1 (bfun=bfun@entry=0x563eb62559f0 , arg=arg@entry=0x563ec43bdc65, handlers=, hfun=hfun@entry=0x563eb620b960 ) at eval.c:1498 #52 0x0000563eb62090a8 in redisplay_windows (window=0x563ec43bdc65) at xdisp.c:17416 #53 0x0000563eb623dce2 in redisplay_internal () at xdisp.c:16866 #54 0x0000563eb623f095 in redisplay () at xdisp.c:16049 #55 0x0000563eb632a483 in read_char (commandflag=1, map=map@entry=0x563ec421b423, prev_event=0x0, used_mouse_menu=used_mouse_menu@entry=0x7ffce40e30db, end_time=end_time@entry=0x0) at keyboard.c:2627 #56 0x0000563eb632cdb3 in read_key_sequence (keybuf=keybuf@entry=0x7ffce40e3210, prompt=prompt@entry=0x0, dont_downcase_last=dont_downcase_last@entry=false, can_return_switch_frame=can_return_switch_frame@entry=true, fix_current_buffer=fix_current_buffer@entry=true, prevent_redisplay=prevent_redisplay@entry=false) at keyboard.c:10074 #57 0x0000563eb632ec75 in command_loop_1 () at keyboard.c:1375 #58 0x0000563eb63aaa47 in internal_condition_case (bfun=bfun@entry=0x563eb632eab0 , handlers=handlers@entry=0x90, hfun=hfun@entry=0x563eb6321ac0 ) at eval.c:1474 #59 0x0000563eb631a4d6 in command_loop_2 (handlers=handlers@entry=0x90) at keyboard.c:1124 #60 0x0000563eb63aa9a1 in internal_catch (tag=tag@entry=0x10050, func=func@entry=0x563eb631a4b0 , arg=arg@entry=0x90) at eval.c:1197 #61 0x0000563eb631a471 in command_loop () at keyboard.c:1102 #62 0x0000563eb6321642 in recursive_edit_1 () at keyboard.c:711 #63 0x0000563eb63219d0 in Frecursive_edit () at keyboard.c:794 #64 0x0000563eb61eca5f in main (argc=1, argv=0x7ffce40e36d8) at emacs.c:2529 I tried using the "finish" gdb command from this point and here is what happened: - (gdb) finish Run till exit from #0 0x00007f11e8d139df in poll () from /usr/lib/libc.so.6 0x00007f11ec43726b in ?? () from /usr/lib/libxcb.so.1 (gdb) finish Run till exit from #0 0x00007f11ec43726b in ?? () from /usr/lib/libxcb.so.1 0x00007f11ec438d1d in xcb_wait_for_event () from /usr/lib/libxcb.so.1 (gdb) finish Run till exit from #0 0x00007f11ec438d1d in xcb_wait_for_event () from /usr/lib/libxcb.so.1 0x00007f11ec49ab09 in _XReadEvents () from /usr/lib/libX11.so.6 (gdb) finish Run till exit from #0 0x00007f11ec49ab09 in _XReadEvents () from /usr/lib/libX11.so.6 0x00007f11ec48143a in XIfEvent () from /usr/lib/libX11.so.6 (gdb) finish Run till exit from #0 0x00007f11ec48143a in XIfEvent () from /usr/lib/libX11.so.6 (at this point the "finish" command does not return). I hope that helps. I will try to reproduce the problem while running in gdb and I will send an update if I'm successful. Kind regards, -- Simon Pugnet https://www.polaris64.net/