GNU bug report logs - #79193
31.0.50; feature/igc: crashes with no gui frame

Previous Next

Package: emacs;

Reported by: john muhl <jm <at> pub.pink>

Date: Thu, 7 Aug 2025 17:10:02 UTC

Severity: normal

Found in version 31.0.50

To reply to this bug, email your comments to 79193 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79193; Package emacs. (Thu, 07 Aug 2025 17:10:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to john muhl <jm <at> pub.pink>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 07 Aug 2025 17:10:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: john muhl <jm <at> pub.pink>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; feature/igc: crashes with no gui frame
Date: Thu, 07 Aug 2025 12:09:19 -0500
Recently (since a0757e0ac05) Emacs has been crashing regularly when
running with only tty frames. It could be a coincidence but keeping a
gui frame around has let me run crash free for days, then I get rid of
that frame and within a couple of hours at most Emacs crashes.

I haven’t been able to find a recipe that reliably crashes but hit them
in various everyday usage like C-n in a dired buffer, C-xb otherbuf TAB,
C/M-v, etc. This latest crash was after pressing SPC in a gnus summary
buffer to go the next unread article.

I still have the crashed session attached to gdb around if there is
anything else that would help.

(gdb) bt full
#0  terminate_due_to_signal (sig=11, backtrace_limit=40) at emacs.c:444
No locals.
#1  0x000055555589a228 in handle_fatal_signal (sig=11) at sysdep.c:1793
No locals.
#2  0x000055555589a2b2 in deliver_thread_signal (sig=11, handler=0x55555589a210 <handle_fatal_signal>) at sysdep.c:1785
        old_errno = 2
#3  0x00005555558959ea in deliver_fatal_thread_signal (sig=11) at sysdep.c:1805
No locals.
#4  0x000055555589a342 in handle_sigsegv (sig=11, siginfo=0x555555bfb7f0 <sigsegv_stack+62928>, arg=0x555555bfb6c0 <sigsegv_stack+62624>) at sysdep.c:1943
        fatal = false
#5  <signal handler called>
No locals.
#6  0x00007ffff57d0327 in __GI_kill () at ../sysdeps/unix/syscall-template.S:120
No locals.
#7  0x0000555555b5f0f9 in sigHandle ()
No symbol table info available.
#8  <signal handler called>
No locals.
#9  0x00005555556ca07a in line_hash_code (f=0x7fff43aae670, row=0x555556059240) at dispnew.c:1196
        c = 32
        face_id = 0
        glyph = 0x55556d380850
        end = 0x55556d3820d0
        hash = 0
#10 0x00005555556c83f2 in scrolling (frame=0x7fff43aae670) at dispnew.c:5827
        unchanged_at_top = 0
        unchanged_at_bottom = 45
        window_size = 0
        changed_lines = 0
        i = 0
        height = 45
        free_at_end_vpos = 45
        current_matrix = 0x55555632fe30
        desired_matrix = 0x555555ccc520
        old_hash = 0x7fffffff95d0
        sa_avail = 15664
        sa_count = {
          bytes = 192
        }
        new_hash = 0x7fffffff9684
        draw_cost = 0x7fffffff9738
        old_draw_cost = 0x7fffffff97ec
#11 0x00005555556b9749 in write_matrix (f=0x7fff43aae670, inhibit_id_p=false, updating_menu_p=false) at dispnew.c:5772
        first_row = 0
        last_row = 21845
#12 0x00005555556b906d in combine_updates_for_frame (f=0x7fff43aae670, inhibit_scrolling=false) at dispnew.c:4085
        root = 0x7fff43aae670
        z_order = {
          i = 0x7fff44c58d0b
        }
        topmost_child = 0x0
#13 0x00005555556ba424 in combine_updates (roots=...) at dispnew.c:4135
        root = 0x7fff43aae670
#14 0x000055555570f6f6 in redisplay_internal () at xdisp.c:17807
        tty_root_frames = {
          i = 0x7fff44c4d4cb
        }
        MAX_HSCROLL_RETRIES = MAX_HSCROLL_RETRIES
        MAX_GARBAGED_FRAME_RETRIES = MAX_GARBAGED_FRAME_RETRIES
        w = 0x7fff467b0748
        sw = 0x7fff467b0748
        fr = 0x7fff4399e000
        must_finish = true
        match_p = true
        tlbufpos = {
          charpos = 6192,
          bytepos = 6197
        }
        tlendpos = {
          charpos = 0,
          bytepos = 0
        }
        number_of_visible_frames = 2
        sf = 0x7fff4399e000
        polling_stopped_here = true
        tail = {
          i = 0x0
        }
        frame = {
          i = 0x7fff43aae675
        }
        hscroll_retries = 0
        garbaged_frame_retries = 0
        consider_all_windows_p = true
        update_miniwindow_p = true
        count = {
          bytes = 96
        }
        previous_frame = 0x7fff4399e000
        current_matrices_cleared = false
        new_count = 32767
#15 0x00005555557179b9 in redisplay () at xdisp.c:16850
No locals.
#16 0x000055555585d1d0 in read_char (commandflag=1, map=..., prev_event=..., used_mouse_menu=0x7fffffffd4df, end_time=0x0) at keyboard.c:2689
        echo_current = true
        c = {
          i = 0x0
        }
        local_getcjmp = {{
            __jmpbuf = {55832, 0, 160, 55832, 93824999301240, 55832, 55832, 55832},
            __mask_was_saved = 55832,
            __saved_mask = {
              __val = {55832, 140737488342704, 93824995580517, 0, 192, 140734347075432, 140734347075435, 160, 445, 118, 563, 6, 557, 2, 140734576048900, 1030}
            }
          }}
        save_jump = {{
            __jmpbuf = {14323566176, 24, 140737488342304, 93824997369764, 59136, 12884901912, 140734347075432, 140734347075435},
            __mask_was_saved = -12976,
            __saved_mask = {
              __val = {93824997369689, 140734347075432, 140734347075411, 55832, 140734347075435, 140737488342400, 93824996183549, 96, 140734347075411, 55832, 140734347075435, 140737488342704, 93824995566605, 0, 140734576049085, 56}
            }
          }}
        tem = {
          i = 0x7fffe8001a00
        }
        save = {
          i = 0x7fff44c3df68
        }
        previous_echo_area_message = {
          i = 0x0
        }
        also_record = {
          i = 0x0
        }
        reread = false
        recorded = false
        polling_stopped_here = false
        orig_kboard = 0x555556c4a1b0
        jmpcount = {
          bytes = 1
        }
        c_volatile = {
          i = 0x38
        }
#17 0x0000555555859b1a in read_key_sequence (keybuf=0x7fffffffd9f0, prompt=..., dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false, disable_text_conversion_p=false) at keyboard.c:11197
        interrupted_kboard = 0x555556c4a1b0
        interrupted_frame = 0x7fff4399e000
        key = {
          i = 0x7d2
        }
        used_mouse_menu = false
        echo_local_start = 0
        last_real_key_start = 0
        keys_local_start = 0
        new_binding = {
          i = 0x0
        }
        count = {
          bytes = 96
        }
        t = 0
        echo_start = 0
        keys_start = 0
        current_binding = {
          i = 0x7fff44c3df6b
        }
        first_unbound = 31
        mock_input = 0
        used_mouse_menu_history = {false <repeats 30 times>}
        fkey = {
          parent = {
            i = 0x7fff439da8ab
          },
          map = {
            i = 0x7fff439da8ab
          },
          start = 0,
          end = 0
        }
        keytran = {
          parent = {
            i = 0x7fff4398eeab
          },
          map = {
            i = 0x7fff4398eeab
          },
          start = 0,
          end = 0
        }
        indec = {
          parent = {
            i = 0x7fff439da893
          },
          map = {
            i = 0x7fff439da893
          },
          start = 0,
          end = 0
        }
        shift_translated = false
        delayed_switch_frame = {
          i = 0x0
        }
        original_uppercase = {
          i = 0x0
        }
        original_uppercase_position = -1
        starting_buffer = 0x7fff46678f50
        fake_prefixed_keys = {
          i = 0x0
        }
        first_event = {
          i = 0x0
        }
        second_event = {
          i = 0x0
        }
#18 0x00005555558577a6 in command_loop_1 () at keyboard.c:1441
        keybuf = {{
            i = 0x82
          }, {
            i = 0x555555958162 <builtin_lisp_symbol+34>
          }, {
            i = 0x56069dd0
          }, {
            i = 0x0
          }, {
            i = 0x7fffffffda90
          }, {
            i = 0x555555958bd1 <unbind_to+305>
          }, {
            i = 0x0
          }, {
            i = 0x0
          }, {
            i = 0x555556069e30
          }, {
            i = 0x0
          }, {
            i = 0x0
          }, {
            i = 0xc
          }, {
            i = 0x13e80
          }, {
            i = 0x38
          }, {
            i = 0x7fff46678f55
          }, {
            i = 0x0
          }, {
            i = 0x0
          }, {
            i = 0x0
          }, {
            i = 0x60
          }, {
            i = 0x0
          }, {
            i = 0x7fffffffdbf0
          }, {
            i = 0x555555858ca3 <cmd_error+915>
          }, {
            i = 0x555556c4a1b0
          }, {
            i = 0x555556c4a1b0
          }, {
            i = 0x56069dd0
          }, {
            i = 0x7fff44a6ed68
          }, {
            i = 0x0
          }, {
            i = 0x0
          }, {
            i = 0x0
          }, {
            i = 0x0
          }}
        i = 1
        last_pt = 6192
        cmd = {
          i = 0x2aa9edeab5a8
        }
        prev_modiff = 8343
        prev_buffer = 0x7fff46678f50
#19 0x000055555595ebd1 in internal_condition_case (bfun=0x5555558571c0 <command_loop_1>, handlers=..., hfun=0x555555858910 <cmd_error>) at eval.c:1713
        val = {
          i = 0x0
        }
        c = 0x555555cc74b0
#20 0x0000555555857173 in command_loop_2 (handlers=...) at keyboard.c:1180
        val = {
          i = 0x2
        }
#21 0x000055555595dc6f in internal_catch (tag=..., func=0x555555857150 <command_loop_2>, arg=...) at eval.c:1393
        val = {
          i = 0xa8
        }
        c = 0x555555cc7320
#22 0x000055555585638e in command_loop () at keyboard.c:1158
No locals.
#23 0x0000555555856160 in recursive_edit_1 () at keyboard.c:766
        count = {
          bytes = 32
        }
        val = {
          i = 0x55555595e141 <record_unwind_protect+129>
        }
#24 0x00005555558566af in Frecursive_edit () at keyboard.c:849
        count = {
          bytes = 0
        }
        buffer = {
          i = 0x0
        }
#25 0x00005555558529dc in main (argc=1, argv=0x7fffffffe248) at emacs.c:2651
        stack_bottom_variable = 0x555555c7d560
        old_argc = 1
        dump_file = 0x0
        no_loadup = false
        junk = 0x0
        dname_arg = 0x0
        ch_to_dir = 0x0
        original_pwd = 0x0
        dump_mode = 0x0
        skip_args = 0
        temacs = 0x0
        attempt_load_pdump = true
        only_version = false
        rlim = {
          rlim_cur = 10022912,
          rlim_max = 18446744073709551615
        }
        lc_all = 0x0
        sockfd = -1
        module_assertions = false

Lisp Backtrace:
"redisplay_internal (C function)" (0x0)

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.49, cairo version 1.18.4) of 2025-08-03 built on nano
Repository revision: 92f52805f9e99068ff07148a3a76b1d97e77adbf
Repository branch: feature/igc
System Description: Void Linux

Configured using:
 'configure CC=clang 'CFLAGS=-O0 -g3' CPPFLAGS=-I/home/jm/opt/mps
 'LDFLAGS=-L/home/jm/opt/mps -fuse-ld=lld' --enable-check=yes,glyphs
 --enable-check-lisp-object-type --with-mps --with-pgtk
 --without-native-compilation'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBXML2 MODULES MPS NOTIFY INOTIFY PDUMPER PGTK PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP
XIM GTK3 ZLIB

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  bug-reference-prog-mode: t
  checkdoc-minor-mode: t
  outline-minor-mode: t
  whitespace-mode: t
  flyspell-mode: t
  midnight-mode: t
  kill-ring-deindent-mode: t
  global-paren-face-mode: t
  paren-face-mode: t
  global-kkp-mode: t
  desktop-save-mode: t
  cua-mode: t
  auto-insert-mode: t
  savehist-mode: t
  save-place-mode: t
  repeat-mode: t
  global-auto-revert-mode: t
  electric-pair-mode: t
  delete-selection-mode: t
  minibuffer-electric-default-mode: t
  global-completion-preview-mode: t
  completion-preview-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-quote-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  prettify-symbols-mode: t
  tab-bar-history-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  auto-save-visited-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr gnus-msg 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 xdg url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util
mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int gnus-range
gnus-win emacsbug message mailcap yank-media puny rfc822 mml mml-sec epa
derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums vc-git diff-mode track-changes files-x vc vc-dispatcher
bug-reference checkdoc lisp-mnt thingatpt noutline outline disp-table
whitespace flyspell ispell auth-source-pass url-parse url-vars
auth-source cl-seq eieio eieio-core cl-macs password-cache json map
server noco-theme unspecified-theme most-faces color time window-x
dired-x dired dired-loaddefs help-at-pt cursor-sensor midnight
indent-aux gnus nnheader gnus-util text-property-search time-date subr-x
mail-utils range mm-util mail-prsvr paren-face kkp term/xterm xterm
byte-opt gv bytecomp byte-compile compat desktop frameset cua-base
autoinsert fennel-mode-autoloads gauge-autoloads gauge
indent-bars-autoloads kkp-autoloads nanoid-autoloads
paren-face-autoloads unspecified-theme-autoloads most-faces-autoloads
xr-autoloads rx blase-theme cl-extra help-mode blase-defaults-theme
savehist saveplace repeat autorevert filenotify elec-pair delsel
easy-mmode blase-completion-theme minibuf-eldef completion-preview
site-start cus-edit pp cus-start cus-load icons wid-edit cl-loaddefs
cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win
pgtk-win term/common-win touch-screen pgtk-dnd 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 dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty move-toolbar make-network-process tty-child-frames 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))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79193; Package emacs. (Thu, 07 Aug 2025 17:32:02 GMT) Full text and rfc822 format available.

Message #8 received at 79193 <at> debbugs.gnu.org (full text, mbox):

From: Pip Cet <pipcet <at> protonmail.com>
To: john muhl <jm <at> pub.pink>
Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
 Helmut Eller <eller.helmut <at> gmail.com>, 79193 <at> debbugs.gnu.org
Subject: Re: bug#79193: 31.0.50; feature/igc: crashes with no gui frame
Date: Thu, 07 Aug 2025 17:31:23 +0000
"john muhl" <jm <at> pub.pink> writes:

> I still have the crashed session attached to gdb around if there is
> anything else that would help.

Please keep it around, and also generate a coredump file in case we
accidentally lose it (the gdb command to do that is "gcore")

> (gdb) bt full
> #0  terminate_due_to_signal (sig=11, backtrace_limit=40) at emacs.c:444
> No locals.
> #1  0x000055555589a228 in handle_fatal_signal (sig=11) at sysdep.c:1793
> No locals.
> #2  0x000055555589a2b2 in deliver_thread_signal (sig=11, handler=0x55555589a210 <handle_fatal_signal>) at sysdep.c:1785
>         old_errno = 2
> #3  0x00005555558959ea in deliver_fatal_thread_signal (sig=11) at sysdep.c:1805
> No locals.
> #4  0x000055555589a342 in handle_sigsegv (sig=11, siginfo=0x555555bfb7f0 <sigsegv_stack+62928>, arg=0x555555bfb6c0 <sigsegv_stack+62624>) at sysdep.c:1943
>         fatal = false
> #5  <signal handler called>
> No locals.
> #6  0x00007ffff57d0327 in __GI_kill () at ../sysdeps/unix/syscall-template.S:120
> No locals.
> #7  0x0000555555b5f0f9 in sigHandle ()
> No symbol table info available.
> #8  <signal handler called>
> No locals.
> #9  0x00005555556ca07a in line_hash_code (f=0x7fff43aae670, row=0x555556059240) at dispnew.c:1196
>         c = 32
>         face_id = 0
>         glyph = 0x55556d380850
>         end = 0x55556d3820d0
>         hash = 0

Could you show glyph->frame, f, *glyph->frame, and *f in this stack
frame?

Is it possible we're simply failing to trace glyph->frame in
fix_glyph_matrix? Is there some reason those frames should be pinned,
but might fail to be?

Thanks!

Pip





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79193; Package emacs. (Thu, 07 Aug 2025 17:52:02 GMT) Full text and rfc822 format available.

Message #11 received at 79193 <at> debbugs.gnu.org (full text, mbox):

From: Pip Cet <pipcet <at> protonmail.com>
To: john muhl <jm <at> pub.pink>
Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
 Helmut Eller <eller.helmut <at> gmail.com>, 79193 <at> debbugs.gnu.org
Subject: Re: bug#79193: 31.0.50; feature/igc: crashes with no gui frame
Date: Thu, 07 Aug 2025 17:51:12 +0000
Pip Cet <pipcet <at> protonmail.com> writes:

> "john muhl" <jm <at> pub.pink> writes:

>> (gdb) bt full
>> #0  terminate_due_to_signal (sig=11, backtrace_limit=40) at emacs.c:444
>> No locals.
>> #1  0x000055555589a228 in handle_fatal_signal (sig=11) at sysdep.c:1793
>> No locals.
>> #2  0x000055555589a2b2 in deliver_thread_signal (sig=11, handler=0x55555589a210 <handle_fatal_signal>) at sysdep.c:1785
>>         old_errno = 2
>> #3  0x00005555558959ea in deliver_fatal_thread_signal (sig=11) at sysdep.c:1805
>> No locals.
>> #4  0x000055555589a342 in handle_sigsegv (sig=11, siginfo=0x555555bfb7f0 <sigsegv_stack+62928>, arg=0x555555bfb6c0 <sigsegv_stack+62624>) at sysdep.c:1943
>>         fatal = false
>> #5  <signal handler called>
>> No locals.
>> #6  0x00007ffff57d0327 in __GI_kill () at ../sysdeps/unix/syscall-template.S:120
>> No locals.
>> #7  0x0000555555b5f0f9 in sigHandle ()
>> No symbol table info available.
>> #8  <signal handler called>
>> No locals.
>> #9  0x00005555556ca07a in line_hash_code (f=0x7fff43aae670, row=0x555556059240) at dispnew.c:1196
>>         c = 32
>>         face_id = 0
>>         glyph = 0x55556d380850
>>         end = 0x55556d3820d0
>>         hash = 0
>
> Could you show glyph->frame, f, *glyph->frame, and *f in this stack
> frame?
>
> Is it possible we're simply failing to trace glyph->frame in
> fix_glyph_matrix? Is there some reason those frames should be pinned,
> but might fail to be?

Assuming the answers are "yes" and "no", respectively, I think these two
patches might help:

John, would it be possible for you to keep your current Emacs session
alive in gdb but start a new one with these patches to see whether the
issue still happens?

From 2fb119758582ab202e1691bd14d7545c6cbf948c Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet <at> protonmail.com>
Date: Thu, 7 Aug 2025 17:41:14 +0000
Subject: [PATCH 1/2] [MPS] Fix hashing of text terminal lines (bug#79193)

* src/dispnew.c (line_hash_code) [MPS]: Use 'igc_hash', not the
address of a movable object, as a hash value.
---
 src/dispnew.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/dispnew.c b/src/dispnew.c
index 1eaab64d876..755422b7cf1 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1192,8 +1192,17 @@ line_hash_code (struct frame *f, struct glyph_row *row)
 	     index into the frame's face cache), we need the hash
 	     value to include something specific to the frame, and we
 	     use the frame cache's address for that purpose.  */
+#ifndef HAVE_MPS
 	  if (glyph->frame && glyph->frame != f)
 	    face_id += (uintptr_t) glyph->frame->face_cache;
+#else
+	  if (glyph->frame && glyph->frame != f)
+	    {
+	      Lisp_Object face_cache;
+	      XSETVECTOR (face_cache, glyph->frame->face_cache);
+	      face_id += igc_hash (face_cache);
+	    }
+#endif
 	  if (FRAME_MUST_WRITE_SPACES (f))
 	    c -= SPACEGLYPH;
 	  hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + c;
-- 
2.50.0

From 88bd0327b90ba599a31e5ecbb4eabb36c557f7b8 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet <at> protonmail.com>
Date: Thu, 7 Aug 2025 17:42:29 +0000
Subject: [PATCH 2/2] [MPS] Trace frame pointer in glyphs (bug#79193)

* src/igc.c (fix_glyph_pool):
(fix_glyph_matrix): Trace the ->frame pointer in a glyph structure
when fixing the glyph.
---
 src/igc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/igc.c b/src/igc.c
index 765b6a47fb2..966dcb30ac2 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -2282,6 +2282,7 @@ fix_glyph_pool (mps_ss_t ss, struct glyph_pool *pool)
     for (ptrdiff_t i = 0; i < pool->nglyphs; ++i)
       {
 	IGC_FIX12_OBJ (ss, &pool->glyphs[i].object);
+	IGC_FIX12_PVEC (ss, &pool->glyphs[i].frame);
       }
   }
   MPS_SCAN_END (ss);
@@ -2304,7 +2305,10 @@ fix_glyph_matrix (mps_ss_t ss, struct glyph_matrix *matrix)
 	      struct glyph *glyph = row->glyphs[area];
 	      struct glyph *end_glyph = glyph + row->used[area];
 	      for (; glyph < end_glyph; ++glyph)
-		IGC_FIX12_OBJ (ss, &glyph->object);
+		{
+		  IGC_FIX12_OBJ (ss, &glyph->object);
+		  IGC_FIX12_PVEC (ss, &glyph->frame);
+		}
 	    }
 	}
     IGC_FIX12_PVEC (ss, &matrix->buffer);
-- 
2.50.0

Of course, this may fail to work because of the glyph pool tracing bug
Helmut discovered; Helmut, do you have a preference for how to fix that?
My preference would be to simply use igc_xzalloc_ambig, but I also have
code here to make glyph pools, and glyph arrays, special IGC object
types.

Thanks!
Pip





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79193; Package emacs. (Thu, 07 Aug 2025 18:01:02 GMT) Full text and rfc822 format available.

Message #14 received at 79193 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Pip Cet <pipcet <at> protonmail.com>
Cc: john muhl <jm <at> pub.pink>, Helmut Eller <eller.helmut <at> gmail.com>,
 79193 <at> debbugs.gnu.org
Subject: Re: bug#79193: 31.0.50; feature/igc: crashes with no gui frame
Date: Thu, 07 Aug 2025 19:59:54 +0200
Pip Cet <pipcet <at> protonmail.com> writes:

> Could you show glyph->frame, f, *glyph->frame, and *f in this stack
> frame?
>
> Is it possible we're simply failing to trace glyph->frame in
> fix_glyph_matrix? 

IIRC, the idea was to not trace the glyph::frame in fix_matrix because
that is not enough in the tty case because not everything is a window in
that case. That lead to fix_glyph_pool and fix_glyph_matrix in the tty
windows could be a nop because window matrices on ttys are sub-allocated
from the pools.

No, for some reason I did

  a19e818265e ; Fix last change

which removed the frame from fix_glyph_pool but left the braces which I
normally dislike if it's only a single statement.

And secondly, I don't check for window-system frames in
fix_glyph_matrix.

And my memory of that is entirely erase at the moment. How weird!
What happened?

> Is there some reason those frames should be pinned, but might fail to
> be?

No, that's not required.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79193; Package emacs. (Thu, 07 Aug 2025 18:05:01 GMT) Full text and rfc822 format available.

Message #17 received at 79193 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Pip Cet <pipcet <at> protonmail.com>
Cc: john muhl <jm <at> pub.pink>, Helmut Eller <eller.helmut <at> gmail.com>,
 79193 <at> debbugs.gnu.org
Subject: Re: bug#79193: 31.0.50; feature/igc: crashes with no gui frame
Date: Thu, 07 Aug 2025 20:04:50 +0200
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

> Pip Cet <pipcet <at> protonmail.com> writes:
>
>> Could you show glyph->frame, f, *glyph->frame, and *f in this stack
>> frame?
>>
>> Is it possible we're simply failing to trace glyph->frame in
>> fix_glyph_matrix? 
>
> IIRC, the idea was to not trace the glyph::frame in fix_matrix because
> that is not enough in the tty case because not everything is a window in
> that case. That lead to fix_glyph_pool and fix_glyph_matrix in the tty
> windows could be a nop because window matrices on ttys are sub-allocated
> from the pools.
>
> No, for some reason I did
>
>   a19e818265e ; Fix last change
>
> which removed the frame from fix_glyph_pool but left the braces which I
> normally dislike if it's only a single statement.
>
> And secondly, I don't check for window-system frames in
> fix_glyph_matrix.

I take that back, I just did is differently:

igc.c<cl-packages>:
 2365     if (w->current_matrix && !w->current_matrix->pool)
 2366       IGC_FIX_CALL (ss, fix_glyph_matrix (ss, w->current_matrix));

the pool is null on window systems. So that's okay.But the frame is
missing.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79193; Package emacs. (Thu, 07 Aug 2025 18:19:02 GMT) Full text and rfc822 format available.

Message #20 received at 79193 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Pip Cet <pipcet <at> protonmail.com>
Cc: john muhl <jm <at> pub.pink>, Helmut Eller <eller.helmut <at> gmail.com>,
 79193 <at> debbugs.gnu.org
Subject: Re: bug#79193: 31.0.50; feature/igc: crashes with no gui frame
Date: Thu, 07 Aug 2025 20:18:44 +0200
Pip Cet <pipcet <at> protonmail.com> writes:

> Pip Cet <pipcet <at> protonmail.com> writes:
>
>> "john muhl" <jm <at> pub.pink> writes:
>
>>> (gdb) bt full
>>> #0  terminate_due_to_signal (sig=11, backtrace_limit=40) at emacs.c:444
>>> No locals.
>>> #1  0x000055555589a228 in handle_fatal_signal (sig=11) at sysdep.c:1793
>>> No locals.
>>> #2  0x000055555589a2b2 in deliver_thread_signal (sig=11, handler=0x55555589a210 <handle_fatal_signal>) at sysdep.c:1785
>>>         old_errno = 2
>>> #3  0x00005555558959ea in deliver_fatal_thread_signal (sig=11) at sysdep.c:1805
>>> No locals.
>>> #4  0x000055555589a342 in handle_sigsegv (sig=11, siginfo=0x555555bfb7f0 <sigsegv_stack+62928>, arg=0x555555bfb6c0 <sigsegv_stack+62624>) at sysdep.c:1943
>>>         fatal = false
>>> #5  <signal handler called>
>>> No locals.
>>> #6  0x00007ffff57d0327 in __GI_kill () at ../sysdeps/unix/syscall-template.S:120
>>> No locals.
>>> #7  0x0000555555b5f0f9 in sigHandle ()
>>> No symbol table info available.
>>> #8  <signal handler called>
>>> No locals.
>>> #9  0x00005555556ca07a in line_hash_code (f=0x7fff43aae670, row=0x555556059240) at dispnew.c:1196
>>>         c = 32
>>>         face_id = 0
>>>         glyph = 0x55556d380850
>>>         end = 0x55556d3820d0
>>>         hash = 0
>>
>> Could you show glyph->frame, f, *glyph->frame, and *f in this stack
>> frame?
>>
>> Is it possible we're simply failing to trace glyph->frame in
>> fix_glyph_matrix? Is there some reason those frames should be pinned,
>> but might fail to be?
>
> Assuming the answers are "yes" and "no", respectively, I think these two
> patches might help:
>
> John, would it be possible for you to keep your current Emacs session
> alive in gdb but start a new one with these patches to see whether the
> issue still happens?


I'd rather recommend trying with the commit I mentioned in
my other mail reverted. That should add the tracing of glyph::frame to
the pools. Then let's see further.

> Of course, this may fail to work because of the glyph pool tracing bug
> Helmut discovered; Helmut, do you have a preference for how to fix
> that?

Has there been proof of the bug meanwhile? In the case where Helmut said
that, glyph pools were not even used.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79193; Package emacs. (Thu, 07 Aug 2025 18:43:03 GMT) Full text and rfc822 format available.

Message #23 received at 79193 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Pip Cet <pipcet <at> protonmail.com>
Cc: gerd.moellmann <at> gmail.com, jm <at> pub.pink, eller.helmut <at> gmail.com,
 79193 <at> debbugs.gnu.org
Subject: Re: bug#79193: 31.0.50; feature/igc: crashes with no gui frame
Date: Thu, 07 Aug 2025 21:42:34 +0300
> Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
>  Helmut Eller <eller.helmut <at> gmail.com>, 79193 <at> debbugs.gnu.org
> Date: Thu, 07 Aug 2025 17:51:12 +0000
> From:  Pip Cet via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> --- a/src/dispnew.c
> +++ b/src/dispnew.c
> @@ -1192,8 +1192,17 @@ line_hash_code (struct frame *f, struct glyph_row *row)
>  	     index into the frame's face cache), we need the hash
>  	     value to include something specific to the frame, and we
>  	     use the frame cache's address for that purpose.  */
> +#ifndef HAVE_MPS
>  	  if (glyph->frame && glyph->frame != f)
>  	    face_id += (uintptr_t) glyph->frame->face_cache;
> +#else
> +	  if (glyph->frame && glyph->frame != f)
> +	    {
> +	      Lisp_Object face_cache;
> +	      XSETVECTOR (face_cache, glyph->frame->face_cache);
> +	      face_id += igc_hash (face_cache);
> +	    }

Please make sure that the comment to this code is updated to account
for the HAVE_MPS case.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79193; Package emacs. (Fri, 08 Aug 2025 02:41:01 GMT) Full text and rfc822 format available.

Message #26 received at 79193 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Pip Cet <pipcet <at> protonmail.com>
Cc: john muhl <jm <at> pub.pink>, Helmut Eller <eller.helmut <at> gmail.com>,
 79193 <at> debbugs.gnu.org
Subject: Re: bug#79193: 31.0.50; feature/igc: crashes with no gui frame
Date: Fri, 08 Aug 2025 04:40:44 +0200
Pip Cet <pipcet <at> protonmail.com> writes:

 * src/dispnew.c (line_hash_code) [MPS]: Use 'igc_hash', not the
> address of a movable object, as a hash value.
> ---
>  src/dispnew.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/dispnew.c b/src/dispnew.c
> index 1eaab64d876..755422b7cf1 100644
> --- a/src/dispnew.c
> +++ b/src/dispnew.c
> @@ -1192,8 +1192,17 @@ line_hash_code (struct frame *f, struct glyph_row *row)
>  	     index into the frame's face cache), we need the hash
>  	     value to include something specific to the frame, and we
>  	     use the frame cache's address for that purpose.  */
> +#ifndef HAVE_MPS
>  	  if (glyph->frame && glyph->frame != f)
>  	    face_id += (uintptr_t) glyph->frame->face_cache;
> +#else
> +	  if (glyph->frame && glyph->frame != f)
> +	    {
> +	      Lisp_Object face_cache;
> +	      XSETVECTOR (face_cache, glyph->frame->face_cache);
> +	      face_id += igc_hash (face_cache);
                         ^^^^^^^^
BTW, good catch!             




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79193; Package emacs. (Fri, 08 Aug 2025 06:41:02 GMT) Full text and rfc822 format available.

Message #29 received at 79193 <at> debbugs.gnu.org (full text, mbox):

From: Helmut Eller <eller.helmut <at> gmail.com>
To: Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs <at> gnu.org>
Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
 Pip Cet <pipcet <at> protonmail.com>, john muhl <jm <at> pub.pink>,
 79193 <at> debbugs.gnu.org
Subject: Re: bug#79193: 31.0.50; feature/igc: crashes with no gui frame
Date: Fri, 08 Aug 2025 08:40:48 +0200
On Thu, Aug 07 2025, Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

[...]
> Of course, this may fail to work because of the glyph pool tracing bug
> Helmut discovered; Helmut, do you have a preference for how to fix that?
> My preference would be to simply use igc_xzalloc_ambig, but I also have
> code here to make glyph pools, and glyph arrays, special IGC object
> types.

I would prefer to have a reproducible test case first.  So far the
problem is only theoretical; we don't know whether it occurs in
practice.  If it actually occurs, then we can decide how to fix it.

Helmut




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79193; Package emacs. (Fri, 08 Aug 2025 06:42:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79193; Package emacs. (Mon, 11 Aug 2025 20:59:01 GMT) Full text and rfc822 format available.

Message #35 received at 79193 <at> debbugs.gnu.org (full text, mbox):

From: john muhl <jm <at> pub.pink>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: Pip Cet <pipcet <at> protonmail.com>, Helmut Eller <eller.helmut <at> gmail.com>,
 79193 <at> debbugs.gnu.org
Subject: Re: bug#79193: 31.0.50; feature/igc: crashes with no gui frame
Date: Mon, 11 Aug 2025 15:57:48 -0500
Oops. I see the previous message was only sent to Gerd.

Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

> john muhl <jm <at> pub.pink> writes:
>
>>> I'd rather recommend trying with the commit I mentioned in
>>> my other mail reverted. That should add the tracing of glyph::frame to
>>> the pools. Then let's see further.
>>
>> Made it through the weekend crash-free with Pip’s patches. Should I go
>> ahead and instead run with the mentioned commit reverted?
>
> Thanks, that's good news.
>
> I think there's no need to test the other case, because Pip's contained
> that already. And Pip's fix in dispnew.c is probably unrelated, but
> correct, in my understanding. 

Sounds good. Thanks.




This bug report was last modified 8 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.