Subject: 31.0.50; igc: infinite loop

From: Óscar Fuentes <[email-masked]>
Date: Mon, 14 Jul 2025 13:15:43 +0200

On a long-lived emacs session (two weeks of intensive use), while
reverting a versioned file with C-x v u (something that I did multiple
times before on the same session) Emacs entered an infinite loop using
100% CPU, ignoring C-g and SIGUSR2 and had to be killed eventually after
attaching gdb and obtaining the backtraces below.

#0  truncate_undo_list (b=b@entry=0x7fb33b464b18) at ../../emacs/src/lisp.h:1534
        list = <optimized out>
        prev = <optimized out>
        next = <optimized out>
        last_boundary = 0x0
        size_so_far = 20445947
        count = {bytes = <optimized out>}
        undo_outer_limit = <optimized out>
#1  0x00005596d35701d9 in compact_buffer (buffer=buffer@entry=0x7fb33b464b18)
    at ../../emacs/src/buffer.c:1874
#2  0x00005596d36669e2 in buffer_step (it=<synthetic pointer>) at ../../emacs/src/igc.c:4051
        buf = 0x7fb33b464b1d
        b = 0x7fb33b464b18
#3  igc_on_idle () at ../../emacs/src/igc.c:4083
        work_done = <optimized out>
        clock = {expire = <optimized out>}
        buffer_it = {alist = <optimized out>, buf = <optimized out>}
#4  0x00005596d354f2b5 in timer_check_2 (timers=<optimized out>, idle_timers=<optimized out>)
    at ../../emacs/src/keyboard.c:4722
        now = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        idleness_now = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        now = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        idleness_now = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        funcall = <optimized out>
        chosen_timer = <optimized out>
        timer = <optimized out>
        idle_timer = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--
        difference = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        timer_difference = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        idle_timer_difference = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        ripe = <optimized out>
        timer_ripe = <optimized out>
        idle_timer_ripe = <optimized out>
        timer_time = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        idle_timer_time = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        count = {bytes = <optimized out>}
        old_deactivate_mark = <optimized out>
#5  timer_check () at ../../emacs/src/keyboard.c:4891
        nexttime = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        timers = 0x7fb256c7dc73
        idle_timers = <optimized out>
        tem = <optimized out>
#6  0x00005596d354f7e5 in readable_events (flags=flags@entry=3) at ../../emacs/src/keyboard.c:3618
#7  0x00005596d354f9c0 in get_input_pending (flags=flags@entry=3) at ../../emacs/src/keyboard.c:8007
#8  0x00005596d354fad5 in Finput_pending_p (check_timers=0x38) at ../../emacs/src/keyboard.c:11799
#9  0x00007fb32f4ed5b2 in F7369742d666f72_sit_for_0 ()
    at /home/oscar/dev/emacs/igc/build/src/../native-lisp/31.0.50-61e73da1/preloaded/subr-13adf6a6-dbedbcf7.eln
#10 0x00005596d35d6a0c in Ffuncall (nargs=2, args=0x7fff3751ec00) at ../../emacs/src/eval.c:3195
        count = {bytes = <optimized out>}
        val = <optimized out>
#11 0x00007fb32e40648e in F646973706c61792d7761726e696e67_display_warning_0 ()
    at /home/oscar/.emacs.d/eln-cache/31.0.50-61e73da1/warnings-28e75f4d-f0ade81c.eln
#12 0x00005596d35d6a0c in Ffuncall (nargs=4, args=0x7fff3751ee00) at ../../emacs/src/eval.c:3195
--Type <RET> for more, q to quit, c to continue without paging--
        count = {bytes = <optimized out>}
        val = <optimized out>
#13 0x00007fb32f243db7 in F756e646f2d6f757465722d6c696d69742d7472756e63617465_undo_outer_limit_truncate_0
    ()
    at /home/oscar/dev/emacs/igc/build/src/../native-lisp/31.0.50-61e73da1/preloaded/simple-fab5b0cf-9e866eaa.eln
#14 0x00005596d35d6a0c in Ffuncall (nargs=nargs@entry=2, args=args@entry=0x7fff3751ee80)
    at ../../emacs/src/eval.c:3195
        count = {bytes = <optimized out>}
        val = <optimized out>
#15 0x00005596d35ae9ed in truncate_undo_list (b=b@entry=0x7fb33b464b18) at ../../emacs/src/undo.c:366
        tem = <optimized out>
        list = <optimized out>
        prev = <optimized out>
        next = <optimized out>
        last_boundary = 0x0
        size_so_far = <optimized out>
        count = {bytes = <optimized out>}
        undo_outer_limit = <optimized out>
#16 0x00005596d35701d9 in compact_buffer (buffer=buffer@entry=0x7fb33b464b18)
    at ../../emacs/src/buffer.c:1874
#17 0x00005596d36669e2 in buffer_step (it=<synthetic pointer>) at ../../emacs/src/igc.c:4051
        buf = 0x7fb33b464b1d
        b = 0x7fb33b464b18
#18 igc_on_idle () at ../../emacs/src/igc.c:4083
        work_done = <optimized out>
        clock = {expire = <optimized out>}
--Type <RET> for more, q to quit, c to continue without paging--
        buffer_it = {alist = <optimized out>, buf = <optimized out>}
#19 0x00005596d354f2b5 in timer_check_2 (timers=<optimized out>, idle_timers=<optimized out>)
    at ../../emacs/src/keyboard.c:4722
        now = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        idleness_now = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        now = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        idleness_now = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        funcall = <optimized out>
        chosen_timer = <optimized out>
        timer = <optimized out>
        idle_timer = <optimized out>
        difference = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        timer_difference = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        idle_timer_difference = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        ripe = <optimized out>
        timer_ripe = <optimized out>
        idle_timer_ripe = <optimized out>
        timer_time = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        idle_timer_time = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        count = {bytes = <optimized out>}
        old_deactivate_mark = <optimized out>
#20 timer_check () at ../../emacs/src/keyboard.c:4891
        nexttime = {tv_sec = <optimized out>, tv_nsec = <optimized out>}
        timers = 0x7fb256c795b3
        idle_timers = <optimized out>
        tem = <optimized out>

(gdb) xbacktrace
"sit-for" (0x3751ec08)
"display-warning" (0x3751ee08)
"undo-outer-limit-truncate" (0x3751ee88)
"sit-for" (0x3751f1c8)
"display-warning" (0x3751f3c8)
"undo-outer-limit-truncate" (0x3751f448)
"sit-for" (0x3751f788)
"display-warning" (0x3751f988)
"undo-outer-limit-truncate" (0x3751fa08)
"sit-for" (0x3751fd48)
"display-warning" (0x3751ff48)
"undo-outer-limit-truncate" (0x3751ffc8)
"sit-for" (0x37520308)
"display-warning" (0x37520508)
"undo-outer-limit-truncate" (0x37520588)
"sit-for" (0x375208c8)
"display-warning" (0x37520ac8)
"undo-outer-limit-truncate" (0x37520b48)
"sit-for" (0x37520e88)
"display-warning" (0x37521088)
"undo-outer-limit-truncate" (0x37521108)
"sit-for" (0x37521448)
"display-warning" (0x37521648)
"undo-outer-limit-truncate" (0x375216c8)
"sit-for" (0x37521a08)
"display-warning" (0x37521c08)
"undo-outer-limit-truncate" (0x37521c88)

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.18.4) of 2025-06-29 built on zen
Repository revision: 1c19182e28e90b619a4c3d5553e3b5ae03eccd12
Repository branch: feature/igc
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: Debian GNU/Linux 13 (trixie)

Configured using:
 'configure 'CPPFLAGS=-O2 -fno-omit-frame-pointer -g3'
 CPPFLAGS=-I/home/oscar/dev/include/mps
 LDFLAGS=-L/home/oscar/dev/other/mps/code --with-native-compilation
 --with-tree-sitter --without-toolkit-scroll-bars --with-x-toolkit=lucid
 --with-modules --without-imagemagick --with-mps=yes'

Configured features:
CAIRO FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBOTF
LIBSELINUX LIBXML2 MODULES MPS NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TREE_SITTER WEBP X11 XAW3D XDBE
XIM XPM LUCID ZLIB

Important settings:
  value of $LANG: C
  locale-coding-system: nil

Major mode: Lisp Interaction

Minor modes in effect:
  window-highlight-mode: t
  xterm-mouse-mode: t
  treemacs-filewatch-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: t
  treemacs-fringe-indicator-mode: t
  org-roam-db-autosync-mode: t
  fancy-compilation-mode: t
  diff-hl-flydiff-mode: t
  diff-hl-mode: t
  difftastic-bindings-mode: t
  global-git-commit-mode: t
  pulsar-global-mode: t
  pulsar-mode: t
  evil-owl-mode: t
  enhanced-evil-paredit-mode: t
  evil-local-mode: t
  key-chord-mode: t
  paredit-mode: t
  server-mode: t
  display-fill-column-indicator-mode: t
  vertico-multiform-mode: t
  marginalia-mode: t
  vertico-mode: t
  which-key-mode: t
  global-anzu-mode: t
  anzu-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/oscar/elisp/singles/flx hides /home/oscar/.emacs.d/elpa/flx-20240205.356/flx
/home/oscar/elisp/magit/lisp/magit-section hides /home/oscar/.emacs.d/elpa/magit-section-20250704.2300/magit-section
/home/oscar/elisp/singles/which-key hides /home/oscar/dev/emacs/igc/emacs/lisp/which-key

Features:
(shadow sort mail-extr emacsbug help-fns radix-tree vertico-directory
mule-util vertico-sort fussy window-highlight
solarized-selenized-dark-theme solarized-selenized-light-theme
solarized-palettes solarized solarized-faces xt-mouse term/xterm xterm
meteo-radar lsp-dart lsp-dart-commands lsp-dart-flutter-widget-guide
lsp-dart-flutter-fringe-colors lsp-dart-flutter-colors lsp-dart-outline
lsp-dart-code-lens lsp-lens lsp-dart-test-tree lsp-treemacs
lsp-treemacs-generic lsp-treemacs-themes treemacs-treelib treemacs
treemacs-header-line treemacs-compatibility treemacs-mode
treemacs-bookmarks treemacs-tags treemacs-interface treemacs-persistence
treemacs-filewatch-mode treemacs-follow-mode treemacs-rendering
treemacs-annotations treemacs-async treemacs-workspaces treemacs-dom
treemacs-visuals treemacs-fringe-indicator treemacs-faces treemacs-icons
treemacs-scope treemacs-themes treemacs-core-utils pfuture hl-line
treemacs-logging treemacs-customization treemacs-macros
lsp-dart-test-output lsp-dart-test-support lsp-dart-dap
lsp-dart-devtools lsp-dart-flutter-daemon jsonrpc dap-utils dom xml
dap-mode dap-tasks dap-launch lsp-docker yaml posframe dap-overlays
lsp-dart-closing-labels lsp-dart-utils lsp-dart-protocol lsp-mode
lsp-protocol tree-widget spinner network-stream nsm markdown-mode lv f
flymake flycheck lp0-ts-mode lp0-mode symbol-overlay company-ctags
find-file company-fuzzy ht company aggressive-indent deft orgit
emacsql-sqlite-builtin org-roam-migrate org-roam-log org-roam-mode
org-roam-capture org-roam-id org-roam-node org-roam-db org-roam-utils
org-roam-compat org-roam org-attach emacsql-sqlite emacsql
emacsql-compiler org-noter org-element org-persist org-id
org-element-ast inline avl-tree org-protocol org-capture org-refile
org-crypt 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 noutline outline
ob-emacs-lisp ob-core ob-eval org-cycle org-table org-keys oc
org-loaddefs find-func etags-select etags fileloop generator xref
project ol org-fold org-fold-core org-compat org-version org-macs
cond-star fancy-compilation ffap diff-hl-flydiff diff-hl log-view
difftastic-bindings difftastic view magit-bookmark bookmark git-rebase
magit-dired magit-extras magit-sparse-checkout magit-gitignore
magit-ediff ediff magit-subtree magit-patch magit-submodule magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log magit-diff smerge-mode diff git-commit magit-core
magit-autorevert autorevert filenotify magit-margin magit-transient
magit-process with-editor shell pcomplete magit-mode transient magit-git
magit-base which-func imenu vc-git files-x vc-dir ewoc vc vc-dispatcher
magit-section benchmark cursor-sensor crm llama pulsar pulse color
evil-owl format-spec buffer-flip enhanced-evil-paredit evil-anzu evil
evil-keybindings evil-integration evil-maps evil-commands evil-digraphs
reveal evil-jumps evil-command-window evil-types evil-search evil-ex
evil-macros evil-repeat evil-states evil-core evil-common rect evil-vars
mini-echo mini-echo-segments let-alist hide-mode-line face-remap wgrep
grep ag vc-svn find-dired s dash key-chord comp comp-cstr comp-run
comp-common cmake-mode rx rst compile comint ansi-osc ansi-color
paredit-menu paredit edmacro kmacro server yasnippet lisp-mnt psvn
wid-edit log-edit message sendmail yank-media puny rfc822 mml mml-sec
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 pcvs-util add-log diff-mode track-changes pp elp ediff-merg
ediff-mult ediff-wind ediff-diff ediff-help ediff-init ediff-util dired
dired-loaddefs display-fill-column-indicator vertico-multiform
marginalia vertico flx-rs-core flx-rs flx goto-chg avy ring
highlight-parentheses ws-butler which-key diminish cl anzu easy-mmode
thingatpt tmr pcase compat solar cal-dst cal-menu calendar cal-loaddefs
finder-inf advice cl-extra help-mode warnings disp-table
apropospriate-theme-autoloads company-posframe-autoloads
company-autoloads consult-flycheck-autoloads consult-lsp-autoloads
consult-org-roam-autoloads corfu-autoloads deadgrep-autoloads
diff-hl-autoloads eat-autoloads ellama-autoloads
embark-consult-autoloads consult-autoloads embark-autoloads
flutter-autoloads flycheck-autoloads fussy-autoloads flx-autoloads
groovy-mode-autoloads llm-autoloads lsp-dart-autoloads
dart-mode-autoloads dap-mode-autoloads bui-autoloads
lsp-docker-autoloads lsp-treemacs-autoloads lsp-ui-autoloads
lsp-mode-autoloads f-autoloads marginalia-autoloads
markdown-mode-autoloads org-roam-autoloads magit-section-autoloads
llama-autoloads emacsql-autoloads plz-event-source-autoloads
plz-media-type-autoloads plz-autoloads pomm-autoloads alert-autoloads
log4e-autoloads gntp-autoloads spinner-autoloads swiper-autoloads
ivy-autoloads symbol-overlay-autoloads treemacs-autoloads cfrs-autoloads
posframe-autoloads ht-autoloads hydra-autoloads lv-autoloads
pfuture-autoloads ace-window-autoloads avy-autoloads s-autoloads info
dash-autoloads vertico-autoloads wgrep-ag-autoloads
wgrep-deadgrep-autoloads wgrep-autoloads yaml-autoloads package
browse-url xdg url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util mailcap
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs icons
password-cache json subr-x map byte-opt gv bytecomp byte-compile
url-vars cl-loaddefs cl-lib 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 tty-child-frames native-compile mps
emacs)

Memory information:
((conses 24 0 0) (symbols 56 0 0) (strings 40 0 0) (string-bytes 1 0)
 (vectors 24 0) (vector-slots 8 0 0) (floats 24 0 0)
 (intervals 64 0 0) (buffers 1072 0))