Subject: Re: bug#78444: 30.1; Crash in GC (vector_marked_p)

From: George P <[email-masked]>
Date: Fri, 16 May 2025 15:25:20 -0400

No worries, happy to provide as much info as I can. Unfortunately, gdb
shows XVECTOR as not defined, and I am not sure what the right code to run
for my platform should be.

(gdb) p *XVECTOR(0x98e79dd)
No symbol "XVECTOR" in current context.
(gdb) x/77gx 0x15554f39bca8
0x15554f39bca8: 0x400000000d02f04c      0x000015554f39c08c
0x15554f39bcb8: 0x0000000000000000      0x0000000000000000
0x15554f39bcc8: 0x0000000000ee7cc4      0x0000000000000000
0x15554f39bcd8: 0x0000000000000002      0x0000000000000000
0x15554f39bce8: 0x0000000000000000      0x000015554f39c13d
0x15554f39bcf8: 0x00000000217994b3      0x000000000000d1d0
0x15554f39bd08: 0x0000000021799a93      0x000015554f00256c
0x15554f39bd18: 0x00000000056eaea3      0x0000000000000000
0x15554f39bd28: 0x0000000002268813      0x000015554efee21b
0x15554f39bd38: 0x000015554ef7e9fd      0x000015554efedf45
0x15554f39bd48: 0x000015554ee4ea15      0x0000000000000012
0x15554f39bd58: 0x0000000000000142      0x0000000000000002
0x15554f39bd68: 0x0000000000000000      0x000015554ee1d095
0x15554f39bd78: 0x000015554ee0c815      0x000015554ee2db55
0x15554f39bd88: 0x000015554ee1d2d5      0x0000000000000000
0x15554f39bd98: 0x0000000000000030      0x0000000000000030
0x15554f39bda8: 0x000000000000c0c0      0x000000000000c0c0
0x15554f39bdb8: 0x0000000000000000      0x0000000000000000
0x15554f39bdc8: 0x0000000000000000      0x0000000000000030
0x15554f39bdd8: 0x0000000000000000      0x0000000000000000
0x15554f39bde8: 0x0000000000000000      0x0000000000000000
0x15554f39bdf8: 0x0000000000000030      0x0000000000013710
0x15554f39be08: 0x0000000000000000      0x0000000000000030
0x15554f39be18: 0x0000000000000030      0x0000000000000000
0x15554f39be28: 0x0000000000000000      0x0000000000000000
0x15554f39be38: 0x0000000000000000      0x0000000000000000
0x15554f39be48: 0x0000000000000000      0x0000000000000030
0x15554f39be58: 0x0000000000000000      0x0000000000000856
0x15554f39be68: 0x0000000000000002      0x0000000000000002
0x15554f39be78: 0x0000000000000000      0x0000000000000000
0x15554f39be88: 0x0000000000000030      0x0000000000000000
0x15554f39be98: 0x0000000000000000      0x0000000000000030
0x15554f39bea8: 0x0000000000000030      0x0000000000000000
0x15554f39beb8: 0x0000000000000000      0x0000000021799c83
0x15554f39bec8: 0x000015554ed34bc3      0x00000000025ef753
0x15554f39bed8: 0x0000000000000000      0x0000000000000000
0x15554f39bee8: 0x0000000000000030      0x0000000000000000
0x15554f39bef8: 0x0000000000000000      0x0000000000000000
0x15554f39bf08: 0x0000000000000000
(gdb) p terminal_list->display_info
$1 = {tty = 0x7f3ed10, x = 0x7f3ed10, w32 = 0x7f3ed10, ns = 0x7f3ed10, pgtk
= 0x7f3ed10, haiku = 0x7f3ed10, android = 0x7f3ed10}
(gdb) p *terminal_list->display_info.x
$2 = {next = 0x0, terminal = 0x1405888, display = 0x37c7c70, connection =
13, name_list_element = 0x1420f43, reference_count = 3, untrusted = false,
screen = 0x4ddf5f0, resx = 144, resy = 144, visual = 0x91f9660, visual_info
= {visual = 0x91f9660, visualid = 33, screen = 0, depth = 24, class = 4,
red_mask = 16711680, green_mask = 65280, blue_mask = 255, colormap_size =
256, bits_per_rgb = 8}, pict_format = 0x5c86b68,
  cmap = 32, n_planes = 24, grabbed = 0, icon_bitmap_id = 1, root_window =
789, client_leader_window = 0, vertical_scroll_bar_cursor = 2097154,
horizontal_scroll_bar_cursor = 2097155, invisible_cursor = 2097160,
fixes_pointer_blanking = false, rdb = 0x97e9ab0, smallest_char_width = 1,
smallest_font_height = 2, scratch_cursor_gc = 0x69687d0, mouse_highlight =
{mouse_face_beg_row = -1, mouse_face_beg_col = -1,
    mouse_face_beg_x = 448, mouse_face_end_row = -1, mouse_face_end_col =
-1, mouse_face_end_x = 0, mouse_face_window = 0x0, mouse_face_face_id = 72,
mouse_face_overlay = 0x0, mouse_face_mouse_frame = 0x13cea00,
mouse_face_mouse_x = 308, mouse_face_mouse_y = 1144, mouse_face_past_end =
false, mouse_face_defer = false, mouse_face_hidden = false}, x_id = 1,
x_id_name = REDACTED,
  n_fonts = 74, bitmaps = 0x632aac0, bitmaps_size = 10, bitmaps_last = 1,
meta_mod_mask = 8, shift_lock_mask = 0, alt_mod_mask = 0, super_mod_mask =
64, hyper_mod_mask = 0, Xatom_wm_protocols = 233, Xatom_wm_take_focus =
236, Xatom_wm_save_yourself = 333, Xatom_wm_delete_window = 234,
Xatom_wm_change_state = 238, Xatom_wm_state = 247,
Xatom_wm_configure_denied = 334, Xatom_wm_window_moved = 335,
  Xatom_wm_client_leader = 336, Xatom_wm_transient_for = 68, Xatom_editres
= 337, Xatom_CLIPBOARD = 323, Xatom_TIMESTAMP = 338, Xatom_TEXT = 339,
Xatom_DELETE = 340, Xatom_COMPOUND_TEXT = 325, Xatom_UTF8_STRING = 239,
Xatom_MULTIPLE = 341, Xatom_INCR = 327, Xatom_EMACS_TMP = 342,
Xatom_TARGETS = 326, Xatom_NULL = 344, Xatom_ATOM = 4, Xatom_ATOM_PAIR =
345, Xatom_CLIPBOARD_MANAGER = 346,
  Xatom_EMACS_SERVER_TIME_PROP = 343, Xatom_PIXEL_SIZE = 97,
Xatom_AVERAGE_WIDTH = 102, Xatom_MULE_BASELINE_OFFSET = 349,
Xatom_MULE_RELATIVE_COMPOSE = 350, Xatom_MULE_DEFAULT_ASCENT = 351,
Xatom_DONE = 352, Xatom_PAGE = 353, Xatom_Scrollbar = 354,
Xatom_Horizontal_Scrollbar = 355, Xatom_XEMBED = 356, Xatom_XEMBED_INFO =
347, Xatom_NET_WM_CM_Sn = 322, Xatom_MOTIF_WM_HINTS = 243,
Xatom_MOTIF_DRAG_WINDOW = 386,
  Xatom_MOTIF_DRAG_TARGETS = 387, Xatom_MOTIF_DRAG_AND_DROP_MESSAGE = 388,
Xatom_MOTIF_DRAG_INITIATOR_INFO = 389, Xatom_MOTIF_DRAG_RECEIVER_INFO =
390, Xatom_EMACS_DRAG_ATOM = 348, Xatom_XmTRANSFER_SUCCESS = 391,
Xatom_XmTRANSFER_FAILURE = 392, Xatom_DndProtocol = 393, Xatom_DND_PROTOCOL
= 394, Xatom_text_plain_charset_utf_8 = 395, Xatom_LENGTH = 396,
Xatom_FILE_NAME = 397, Xatom_CHARACTER_POSITION = 398,
  Xatom_LINE_NUMBER = 399, Xatom_COLUMN_NUMBER = 400, Xatom_OWNER_OS = 401,
Xatom_HOST_NAME = 402, Xatom_USER = 403, Xatom_CLASS = 404, Xatom_NAME =
405, Xatom_SAVE_TARGETS = 406, x_focus_frame = 0x13cea00,
x_focus_event_frame = 0x13cea00, highlight_frame = 0x13cea00,
x_pending_autoraise_frame = 0x0, last_mouse_frame = 0x13cea00,
last_mouse_glyph_frame = 0x0, last_mouse_motion_frame = 0x13cea00,
  last_mouse_scroll_bar = 0x0, last_user_time = 2180587218,
last_mouse_motion_x = 308, last_mouse_motion_y = 1144, last_mouse_glyph =
{x = 297, y = 1129, width = 12, height = 24}, last_mouse_movement_time =
2180362343, last_mouse_movement_time_send_event = false, gray = 2097156,
xim = 0x0, xim_styles = 0x0, xim_callback_data = 0x1526290,
preferred_xim_style = 0, xim_coding = 0x0, use_xim = true, color_names =
0x40db850,
  color_names_length = 0x6c54640, color_names_size = 256, color_cells =
0x0, ncolor_cells = 0, red_bits = 8, blue_bits = 8, green_bits = 8,
alpha_bits = 0, red_offset = 16, blue_offset = 0, green_offset = 8,
alpha_offset = 0, alpha_mask = 0, wm_type = X_WMTYPE_UNKNOWN, x_dnd_atoms =
0x78d1b90, x_dnd_atoms_size = 16, x_dnd_atoms_length = 7, motif_drag_atom =
0, motif_drag_atom_name = '\000' <repeats 32 times>,
  motif_drag_atom_time = 0, motif_drag_atom_owner = 0x0, motif_drag_window
= 0, Xatom_net_supported = 248, Xatom_net_supporting_wm_check = 256,
net_supported_atoms = 0x0, nr_net_supported_atoms = 0, net_supported_window
= 0, Xatom_net_window_type = 245, Xatom_net_window_type_tooltip = 293,
Xatom_net_active_window = 254, Xatom_net_wm_state = 241,
Xatom_net_wm_state_fullscreen = 306,
  Xatom_net_wm_state_maximized_horz = 301,
Xatom_net_wm_state_maximized_vert = 300, Xatom_net_wm_state_sticky = 299,
Xatom_net_wm_state_above = 307, Xatom_net_wm_state_below = 308,
Xatom_net_wm_state_hidden = 305, Xatom_net_wm_state_skip_taskbar = 303,
Xatom_net_wm_state_shaded = 302, Xatom_net_frame_extents = 277,
Xatom_net_current_desktop = 242, Xatom_net_workarea = 255,
Xatom_net_wm_opaque_region = 364,
  Xatom_net_wm_ping = 278, Xatom_net_wm_sync_request = 279,
Xatom_net_wm_sync_request_counter = 280, Xatom_net_wm_sync_fences = 358,
Xatom_net_wm_frame_drawn = 360, Xatom_net_wm_frame_timings = 361,
Xatom_net_wm_user_time = 275, Xatom_net_wm_user_time_window = 276,
Xatom_net_client_list_stacking = 250, Xatom_net_wm_pid = 273,
Xatom_net_wm_bypass_compositor = 359, Xatom_xsettings_sel = 407,
Xatom_xsettings_prop = 363,
  Xatom_xsettings_mgr = 283, xsettings_window = 0, Xatom_net_wm_name = 235,
Xatom_net_wm_icon_name = 266, Xatom_net_wm_window_opacity = 357,
Xatom_SM_CLIENT_ID = 362, Xatom_XdndAware = 366, Xatom_XdndSelection = 367,
Xatom_XdndTypeList = 368, Xatom_XdndActionCopy = 369, Xatom_XdndActionMove
= 370, Xatom_XdndActionLink = 371, Xatom_XdndActionAsk = 372,
Xatom_XdndActionPrivate = 373, Xatom_XdndActionList = 374,
  Xatom_XdndActionDescription = 375, Xatom_XdndProxy = 376, Xatom_XdndEnter
= 377, Xatom_XdndPosition = 378, Xatom_XdndStatus = 379, Xatom_XdndLeave =
380, Xatom_XdndDrop = 381, Xatom_XdndFinished = 382, Xatom_XdndDirectSave0
= 383, Xatom_XdndActionDirectSave = 384, Xatom_text_plain = 385, Xatom_Meta
= 135, Xatom_Super = 136, Xatom_Hyper = 137, Xatom_ShiftLock = 365,
Xatom_Alt = 126, modmap = 0x0, ext_codes = 0x1526378,
  xcb_connection = 0x8321690, xcb_visual = 0x8f2d4d4, supports_xdbe = true,
supports_xi2 = true, xi2_version = 3, xi2_opcode = 131, num_devices = 6,
devices = 0x419d830, pending_keystroke_time = 0, pending_keystroke_source =
0, client_pointer_device = -1, supports_xkb = true, xkb_event_type = 84,
xkb_desc = 0x6053aa0, xrender_supported_p = true, xrender_major = 0,
xrender_minor = 11, xfixes_supported_p = true,
  xfixes_major = 5, xfixes_minor = 0, xfixes_event_base = 85,
xsync_supported_p = true, xsync_major = 3, xsync_minor = 1,
xshape_supported_p = true, xshape_major = 1, xshape_minor = 1,
xshape_event_base = 64, xshape_error_base = 0, protected_windows =
0x5684f70, n_protected_windows = 0, protected_windows_max = 256,
screen_width = 10811, screen_height = 3563, screen_mm_width = 0,
screen_mm_height = 0,
  failable_requests = {{start = 127683431, end = 127683431,
selection_serial = 0}, {start = 127683437, end = 127683437,
selection_serial = 0}, {start = 126335699, end = 126335699,
selection_serial = 0}, {start = 126335704, end = 126335704,
selection_serial = 0}, {start = 45081149, end = 45081149, selection_serial
= 0}, {start = 45081155, end = 45081155, selection_serial = 0}, {start = 0,
end = 0,
      selection_serial = 0} <repeats 122 times>}, next_failable_request =
0x7f3f4a0, monitored_selections = 0x15262b0, selection_tracking_window =
2097162, n_monitored_selections = 1, pending_dnd_time = 0,
server_time_monotonic_p = false, server_time_offset = 1703287940194,
quit_keysym = 0, quit_keysym_time = 0}
(gdb) p Vx_use_fast_mouse_position
$3 = (Lisp_Object) 0x0
(gdb)

The size of the core file might provide a good ballpark number.
> "objdump -h /path/to/core" may reveal even more about how much memory
> was in use.

The output of obdjump is very large:

> objdump -h
core.emacs.25439.669e118996bc4380b12acba32b3b7be4.691035.1747332087000000 |
wc -l
13285

> du -h
core.emacs.25439.669e118996bc4380b12acba32b3b7be4.691035.1747332087000000
4.7G
 core.emacs.25439.669e118996bc4380b12acba32b3b7be4.691035.1747332087000000

Can you say more about that?  Are you running using a remote X server,
> or some kind of tunnel setup, or is this some sort of WSL or VM setup?
> It's relevant because remote X sessions have very different timing
> characteristics, and different code for determining mouse positions is
> in use.
>

This is not WSL or VM. I use PUTTY on Windows 10 to connect to a remote
Linux host (which is running the emacs daemon), and then I open the emacs
frame (emacsclient) with X forwarding using Cygwin/X.

Thanks!
George

On Fri, May 16, 2025 at 2:36 PM Pip Cet <[email-masked]> wrote:

> "George P" <[email-masked]> writes:
>
> >  Can you describe what you were doing at the time of the crash?
> >
> > I was not doing anything in particular (editing a latex file with
> LaTeX/PS mode). These crashes have happened to me at very random times. The
> only
> > thing that I have been suspecting could be causing this is viewing
> org-mode buffers that have special fontification. I have
> > https://github.com/awth13/org-appear and
> https://github.com/minad/org-modern installed, and previously I had
> > https://github.com/integral-dw/org-superstar-mode. I had just viewed an
> org file before the crash.
>
> I suspect it's an X problem, but that may be totally wrong.  It may well
> be related to fonts rather than the xterm.c code.
>
> > Unfortunately, I don't have the program running (because I foolishly
> thought I could continue from the crash). I do have the core however, here
> is what
> > you both asked for:
>
> Thank you! Unfortunately, the buffer object itself is not contained
> within the 512 last_marked elements.  Can you also produce the output of
>
>     x/77gx 0x15554f39bca8
>
> so we can see which of the buffer elements we got to?
>
> >  0x1f646393, 0x30, 0x0, 0x98e7985, 0x8f680f4, 0x1f647ac3, 0x1f647ad3,
> 0xdc20, 0xa, 0x1f647aa3, 0x1f647ab3, 0xdb90, 0x2, 0x1f647a53,
> > 0x1f647a93, 0x96c0, 0x1f647a83, 0x3a, 0x1f647a73, 0xa, 0x1f647a63, 0x6,
> 0x98e79dd, 0x98f1d0d, 0x0, 0x400000002300000d, 0x0, 0x27f62ad, 0x0,
>
> That's "gccjit", 14, 2, 1, interspersed with some cons cells, then two
> vectors or pseudovectors, Qnil, and the bogus object.  So we probably
> dumped a compiled unit's data, then returned to the vectors or
> pseudovectors, which would be interesting.
>
> Can you provide the output of:
>
>     p *XVECTOR(0x98e79dd)
>     x/32gx $.contents
>     p *XVECTOR(0x98f1d0d)
>     x/32gx $.contents
>
> >  Also, what is the memory footprint of the crashed Emacs process?
> >
> > Hard for me to say. I restored my session and this is the memory-report
> for that session. I would assume that the crashed session is 2-3 times
> larger:
>
> The size of the core file might provide a good ballpark number.
> "objdump -h /path/to/core" may reveal even more about how much memory
> was in use.
>
> >  Does this mean you run Emacs on a Red Hat system via the Cygwin X
> >  implementation that runs on Windows?
> >
> > Correct.
>
> Can you say more about that?  Are you running using a remote X server,
> or some kind of tunnel setup, or is this some sort of WSL or VM setup?
> It's relevant because remote X sessions have very different timing
> characteristics, and different code for determining mouse positions is
> in use.
>
> Can you also include the output of
>
>     p *terminal_list->display_info
>
> and as much of the output of
>
>     p *terminal_list->display_info.x
>
> as you're comfortable with (x_id_name might be something you would want
> to redact), as well as
>
>     p Vx_use_fast_mouse_position
>
> Background: I have a vague hunch that commit
> ced135ebdbfb0eea719ce165a454e7ff0b681e88 is part of the problem.  This
> replaced the staticpro'd global variable last_mouse_scroll_bar by an
> element of dpyinfo (with the same name) which does not appear to be
> protected from GC.  (The same is true of the last_mouse_frame,
> last_mouse_glyph_frame, last_mouse_motion_frame,
> x_pending_autoraise_frame elements of dpyinfo, and a few others...  I
> don't understand why these aren't GC-protected, and there is no comment
> clearly explaining they shouldn't be, so we could try adding protection
> to them and seeing whether that fixes the crashes).
>
> Thank you, and sorry for requesting so much information!
>
> Pip
>
>