Subject: Re: bug#79014: 31.0.50; igc: infinite loop

From: Eli Zaretskii <[email-masked]>
Date: Mon, 14 Jul 2025 16:16:52 +0300

> Date: Mon, 14 Jul 2025 13:15:43 +0200
> From:  Óscar Fuentes via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> 
> 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)

Any idea what it was trying to warn about in display-warning frames?
I suspect it's some kind of memory-full situation.

Do you still have that session in GDB?