Subject: 30.0.92; partial hang, esp. keyboard events

From: Mike Kupfer <[email-masked]>
Date: Mon, 25 Nov 2024 11:13:00 -0800

I've been getting occasional Emacs hangs, under both Xfce and MATE.  I
haven't seen the problem (so far) with i3.  Emacs seems to handle mouse
events okay, e.g., it looks like point is moving in response to a mouse
click.  And I can create new frames using emacsclient.  But keyboard
events don't seem to be processed--there's no response to C-g, M-x,
C-p, C-n, simple text, F10.

I tried troubleshooting the problem using strace (simple "strace -p
<emacs_pid>"), but there's so much output I've been unable to make sense
of it.

I don't have a reliable recipe for reproducing the problem.  It *might*
be related to closing a frame.

I did not see this problem with 30.0.91.

My current plan for troubleshooting (the next time it happens) is to
attach gdb, dump the last 10 items in recent_keys (using the
instructions in etc/DEBUG), resume the process, type a few keys, go back
into gdb, and see if recent_keys and recent_keys_index have changed.  Is
there a better approach?

thanks,
mike

(gdb) bt
#0  pselect64_syscall
    (sigmask=<optimized out>, timeout=<optimized out>, exceptfds=0x0, writefds=0x7ffcfde93cb0, readfds=0x7ffcfde93c30, nfds=18)
    at ../sysdeps/unix/sysv/linux/pselect.c:34
#1  __pselect
    (nfds=18, readfds=0x7ffcfde93c30, writefds=0x7ffcfde93cb0, exceptfds=0x0, timeout=<optimized out>, sigmask=<optimized out>)
    at ../sysdeps/unix/sysv/linux/pselect.c:56
#2  0x000055bb705d9dee in really_call_select (arg=0x7ffcfde93b40)
    at thread.c:624
#3  0x000055bb705da510 in flush_stack_call_func
    (arg=0x7ffcfde93b40, func=0x55bb705d9d90 <really_call_select>)
    at /home/kupfer/src/emacs-30.0.92/src/lisp.h:4509
#4  thread_select
    (func=<optimized out>, max_fds=max_fds@entry=18, rfds=rfds@entry=0x7ffcfde93c30, wfds=wfds@entry=0x7ffcfde93cb0, efds=efds@entry=0x0, timeout=timeout@entry=0x7ffcfde94270, sigmask=<optimized out>) at thread.c:656
#5  0x000055bb70601b4d in xg_select
    (fds_lim=18, rfds=rfds@entry=0x7ffcfde943a0, wfds=0x7ffcfde94420, efds=0x0, timeout=<optimized out>, sigmask=0x0) at xgselect.c:184
#6  0x000055bb705b6bd7 in wait_reading_process_output
    (time_limit=time_limit@entry=30, nsecs=nsecs@entry=0, read_kbd=read_kbd@entry=-1, do_display=do_display@entry=true, wait_for_cell=wait_for_cell@entry=XIL(0)--Type <RET> for more, q to quit, c to continue without paging--
, wait_proc=wait_proc@entry=0x0, just_wait_proc=0) at process.c:5747
#7  0x000055bb703d3810 in sit_for
    (timeout=timeout@entry=make_fixnum(30), reading=reading@entry=true, display_option=display_option@entry=1) at dispnew.c:6335
#8  0x000055bb704e66bc in read_char
    (commandflag=1, map=map@entry=XIL(0x55bb73d90b73), prev_event=XIL(0), used_mouse_menu=used_mouse_menu@entry=0x7ffcfde94c9b, end_time=end_time@entry=0x0)
    at /home/kupfer/src/emacs-30.0.92/src/lisp.h:746
#9  0x000055bb704e6e8f in read_key_sequence
    (keybuf=keybuf@entry=0x7ffcfde94de0, prompt=prompt@entry=XIL(0), 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, disable_text_conversion_p=false)
    at keyboard.c:10743
#10 0x000055bb704e8e94 in command_loop_1 () at keyboard.c:1429
#11 0x000055bb7055ffc7 in internal_condition_case
    (bfun=bfun@entry=0x55bb704e8ce0 <command_loop_1>, handlers=handlers@entry=XIL(0x90), hfun=hfun@entry=0x55bb704dca90 <cmd_error>) at eval.c:1613
#12 0x000055bb704d4f66 in command_loop_2 (handlers=handlers@entry=XIL(0x90))
    at keyboard.c:1168
#13 0x000055bb7055ff21 in internal_catch
    (tag=tag@entry=XIL(0x11d30), func=func@entry=0x55bb704d4f40 <command_loop_2>, arg=arg@entry=XIL(0x90)) at eval.c:1292
--Type <RET> for more, q to quit, c to continue without paging--c
#14 0x000055bb704d4f01 in command_loop () at keyboard.c:1146
#15 0x000055bb704dc653 in recursive_edit_1 () at keyboard.c:754
#16 0x000055bb704dc9c0 in Frecursive_edit () at keyboard.c:837
#17 0x000055bb703c88c3 in main (argc=1, argv=0x7ffcfde95268) at emacs.c:2635
(gdb) xbacktrace
(gdb)

In GNU Emacs 30.0.92 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw scroll bars) of 2024-10-28 built on alto
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --prefix=/usr/local --with-native-compilation=no'

Configured features:
CAIRO FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX
LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LC_TIME: C
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  delete-selection-mode: t
  display-time-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow mh-identity mh-tool-bar mh-letter mh-show goto-addr gnus-cite
mh-mime mh-acros mh-xface mh-utils emacsbug mule-util
display-line-numbers rect gud pulse color compile etags fileloop xref
project vc-hg diff-mode track-changes easy-mmode bug-reference dired-aux
dired-x oc-basic ol-eww eww url-queue mm-url ol-rmail ol-mhe ol-irc
ol-info ol-gnus nnselect ol-docview doc-view filenotify jka-compr
image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi
face-remap org-agenda org-element org-persist xdg org-id org-element-ast
inline avl-tree generator org-refile org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-src sh-script smie treesit executable
ob-comint org-pcomplete org-list org-footnote org-faces org-entities
org-version ob-emacs-lisp ob-core ob-eval org-cycle org-table ol rx
org-fold org-fold-core org-keys oc org-loaddefs find-func cal-menu
calendar cal-loaddefs org-compat org-macs format-spec misearch
multi-isearch crm thingatpt cus-edit pp cus-start cus-load cl-extra
help-mode mdk-mail gnus-mh gnus-msg mh-comp mh-scan mh-gnus gnus-dup
nnmh gnus-score score-mode gnus-art mm-uu mml2015 mm-view mml-smime
smime gnutls dig gnus-sum shr pixel-fill kinsoku url-file svg dom
gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap
nnmail browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util url-parse
auth-source cl-seq eieio eieio-core cl-macs json map byte-opt gv
bytecomp byte-compile url-vars mail-source utf7 nnoo parse-time iso8601
gnus-spec gnus-int gnus-range gnus-win gnus nnheader range wid-edit mh-e
mh-buffers mh-loaddefs message sendmail mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mailabbrev mail-utils gmm-utils mailheader warnings server
timeclock noutline outline icons cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs advice shell
pcomplete comint subr-x ansi-osc ansi-color ring xcscope delsel time vc
cl-loaddefs cl-lib vc-dispatcher mdk-hacks rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads inotify
dynamic-setting system-font-setting font-render-setting cairo x-toolkit
x multi-tty move-toolbar make-network-process emacs)

Memory information:
((conses 16 491649 89875) (symbols 48 30489 0)
 (strings 32 104582 3918) (string-bytes 1 2859977) (vectors 16 64239)
 (vector-slots 8 1424223 110136) (floats 8 540 756)
 (intervals 56 9625 661) (buffers 984 73))