Subject: bug#71475: closed (Re: bug#71475: 30.0.50; crash in adjust_frame_glyphs (called by delete_frame))

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 11 Jun 2024 20:03:02 +0000

Your bug report

#71475: 30.0.50; crash in adjust_frame_glyphs (called by delete_frame)

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
71475: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71475
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#71475: 30.0.50; crash in adjust_frame_glyphs (called by delete_frame)
From: Stefan Kangas <[email-masked]>
To: Daniel Clemente <[email-masked]>, Eli Zaretskii <[email-masked]>
Cc: [email-masked]
Date: Tue, 11 Jun 2024 20:00:56 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Daniel Clemente <[email-masked]> writes:

> the bug can be closed; thanks.

Done.

Subject: 30.0.50; crash in adjust_frame_glyphs (called by delete_frame)
From: Daniel Clemente <[email-masked]>
To: [email-masked]
Date: Mon, 10 Jun 2024 15:58:33 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

This is a continuation of bug 71224 and it may be a similar issue.
I'm using Emacs without X support but running it in an X terminal.
With glyph debug enabled. emacsclient, with -Q.

I was using the same reproduction procedure as in bug 71224. So I was
randomly mixing these 4 actions:
- call to (debug) to open a backtrace window
- call to (recurse) to cause an error
- open a new frame
- close a frame

In the beginning I was using this for-loop to cause more stress by
opening lots of frames, but I think it's not needed; the crash also
happened when I just had 2 manually opened frames.
for j in `seq 100`; do for i in `seq 10`; do urxvt -e emacsclient
'-nw' '-e' '(dired "~")' &; done; sleep 7 && killall emacsclient; done

Apparently we're in a case in which the frame's glyph matrix exists
but it has 0 rows, and adjust_frame_glyphs doesn't like that.

Backtraces+variables follow.

Lisp nesting exceeds ‘max-lisp-eval-depth’: 1622
Lisp nesting exceeds ‘max-lisp-eval-depth’: 1622

dispnew.c:1851: Emacs fatal error: assertion failed: FRAME_INITIAL_P
(f) || noninteractive || !initialized || (f->current_matrix &&
f->current_matrix->nrows > 0 && f->current_matrix->rows &&
f->desired_matrix && f->desired_matrix->nrows > 0 &&
f->desired_matrix->rows)

Breakpoint 1, terminate_due_to_signal (sig=6,
backtrace_limit=2147483647) at emacs.c:443
443      signal (sig, SIG_DFL);
(gdb) bt
#0  terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at emacs.c:443
#1  0x0000555555735324 in die (
    msg=0x55555584e4e8 "FRAME_INITIAL_P (f) || noninteractive ||
!initialized || (f->current_matrix && f->current_matrix->nrows > 0 &&
f->current_matrix->rows && f->desired_matrix &&
f->desired_matrix->nrows > 0 && f->desire"..., file=0x55555584e231
"dispnew.c", line=1851) at alloc.c:8082
#2  0x0000555555589ecc in adjust_frame_glyphs (f=0x555556438e00) at
dispnew.c:1851
#3  0x0000555555617fe0 in apply_window_adjustment (w=0x5555564392b8)
at window.c:7848
#4  0x000055555560c18a in set_window_buffer
(window=XIL(0x5555564392bd), buffer=XIL(0x7ffff2090c65),
    run_hooks_p=false, keep_margins_p=false) at window.c:4189
#5  0x00005555556e157b in zip_minibuffer_stacks
(dest_window=XIL(0x555555fdd67d),
    source_window=XIL(0x5555564392bd)) at minibuf.c:185
#6  0x00005555556e16f2 in move_minibuffers_onto_frame
(of=0x555556438e00, frame=XIL(0x555555fdd1c5),
    for_deletion=true) at minibuf.c:209
#7  0x000055555559c8ca in delete_frame (frame=XIL(0x555556438e05),
force=XIL(0xc1e0)) at frame.c:2232
#8  0x000055555567814d in delete_terminal (terminal=0x55555649d9b0) at
terminal.c:333
#9  0x00005555556771f0 in delete_tty (terminal=0x55555649d9b0) at term.c:4697
#10 0x0000555555678435 in Fdelete_terminal
(terminal=XIL(0x55555649d9b5), force=XIL(0xc1e0))
    at terminal.c:398
#11 0x00005555556a0239 in gobble_input () at keyboard.c:7931
#12 0x0000555555697d62 in kbd_buffer_get_event (kbp=0x7fffffeff208,
used_mouse_menu=0x0,
    end_time=0x7fffffeff880) at keyboard.c:4036

(gdb) xbacktrace
"sit-for" (0xffeffa98)
"server--message-sit-for" (0xffeffc18)
"server-return-error" (0xffeffde0)
"server--process-filter-1" (0xfff00048)
"server--process-filter-all-pending" (0xfff001d0)
"server-process-filter" (0xfff00348)
"read--expression" (0xf0dff0a8)
"byte-code" (0xfff01d80)
"command-execute" (0xfff025e8)
"recursive-edit" (0xfff02a30)
"debug" (0xfff02bd8)
"eval-expression--debug" (0xfff02d78)
"recurse" (0xfff030e0)
"recurse" (0xfff03360)
"recurse" (0xfff035e0)
"recurse" (0xfff03860)
"recurse" (0xfff03ae0)

(gdb) frame 2
#2  0x0000555555589ecc in adjust_frame_glyphs (f=0x555556438e00) at
dispnew.c:1851
1851          eassert (FRAME_INITIAL_P (f)
(gdb) list
1846      if (FRAME_WINDOW_P (f))
1847        adjust_frame_glyphs_for_window_redisplay (f);
1848      else
1849        {
1850          adjust_frame_glyphs_for_frame_redisplay (f);
1851          eassert (FRAME_INITIAL_P (f)
1852               || noninteractive
1853               || !initialized
1854               || (f->current_matrix
1855               && f->current_matrix->nrows > 0
(gdb)
1856               && f->current_matrix->rows
1857               && f->desired_matrix
1858               && f->desired_matrix->nrows > 0
1859               && f->desired_matrix->rows));
1860        }
1861
1862      /* Don't forget the buffer for decode_mode_spec.  */
1863      adjust_decode_mode_spec_buffer (f);
1864
1865      f->glyphs_initialized_p = true;
(gdb) p FRAME_INITIAL_P(f)
$1 = 0
(gdb) p noninteractive
$2 = false
(gdb) p initialized
$1 = true
(gdb) p f->current_matrix
$3 = (struct glyph_matrix *) 0x55555645f0b0
(gdb) p f->current_matrix->nrows
$4 = 0
(gdb) p f->desired_matrix
$5 = (struct glyph_matrix *) 0x555556815870
(gdb) p f->desired_matrix->nrows
$6 = 0
(gdb)

(gdb) p* f
$8 = {
  header = {
    size = 4611686018595348501
  },
  name = XIL(0x555556428d14),
  icon_name = XIL(0),
  title = XIL(0),
  last_mouse_device = XIL(0),
  focus_frame = XIL(0),
  root_window = XIL(0x555556439025),
  selected_window = XIL(0x555556439025),
  old_selected_window = XIL(0),
  minibuffer_window = XIL(0x5555564392bd),
  param_alist = XIL(0x7ffff0935d63),
  scroll_bars = XIL(0),
  condemned_scroll_bars = XIL(0),
  menu_bar_items = XIL(0),
  face_hash_table = XIL(0x555556439555),
  menu_bar_vector = XIL(0),
  buffer_predicate = XIL(0),
  buffer_list = XIL(0x7ffff0935cf3),
  buried_buffer_list = XIL(0),
  tool_bar_position = XIL(0xfc00),
  tab_bar_items = XIL(0),
  tool_bar_items = XIL(0),
  face_cache = 0x55555656eac0,
  last_tab_bar_item = 0,
  menu_bar_items_used = 0,
  current_pool = 0x5555562588b0,
  desired_pool = 0x5555561acac0,
  desired_matrix = 0x555556815870,
  current_matrix = 0x55555645f0b0,
  glyphs_initialized_p = true,
  resized_p = false,
  default_face_done_p = false,
  already_hscrolled_p = false,
  updated_p = false,
  fonts_changed = false,
  cursor_type_changed = false,
  redisplay = true,
  visible = 1,
  iconified = false,
  garbaged = true,
  wants_modeline = true,
  auto_raise = false,
  auto_lower = false,
  no_split = false,
  explicit_name = false,
  window_change = true,
  window_state_change = false,
  mouse_moved = false,
  pointer_invisible = false,
  frozen_window_starts = false,
  output_method = output_termcap,
  can_set_window_size = false,
  after_make_frame = false,
  tab_bar_redisplayed = false,
  tab_bar_resized = false,
  tool_bar_redisplayed = false,
  tool_bar_resized = false,
  inhibit_horizontal_resize = false,
--Type <RET> for more, q to quit, c to continue without paging--
  inhibit_vertical_resize = false,
  face_change = true,
  inhibit_clear_image_cache = false,
  new_size_p = true,
  was_invisible = false,
  select_mini_window_flag = false,
  change_stamp = 1,
  number_of_windows = 0,
  tab_bar_lines = 0,
  tab_bar_height = 0,
  n_tab_bar_rows = 0,
  n_tab_bar_items = 0,
  tool_bar_lines = 0,
  tool_bar_height = 0,
  n_tool_bar_rows = 0,
  n_tool_bar_items = 0,
  decode_mode_spec_buffer = 0x5555563a32b0 "",
  insert_line_cost = 0x0,
  delete_line_cost = 0x0,
  insert_n_lines_cost = 0x0,
  delete_n_lines_cost = 0x0,
  text_cols = 80,
  text_lines = 24,
  text_width = 80,
  text_height = 24,
  total_cols = 80,
  total_lines = 25,
  pixel_width = 80,
  pixel_height = 25,
  new_width = 130,
  new_height = 54,
  left_pos = 0,
  top_pos = 0,
  win_gravity = 0,
  size_hint_flags = 0,
  border_width = 0,
  child_frame_border_width = 0,
  internal_border_width = 0,
  right_divider_width = 0,
  bottom_divider_width = 0,
  left_fringe_width = 0,
  right_fringe_width = 0,
  fringe_cols = 0,
  menu_bar_lines = 1,
  menu_bar_height = 1,
  column_width = 1,
  line_height = 1,
  terminal = 0x55555649d9b0,
  output_data = {
    tty = 0x555556384b90,
    x = 0x555556384b90,
    w32 = 0x555556384b90,
    ns = 0x555556384b90,
    pgtk = 0x555556384b90,
    haiku = 0x555556384b90,
    android = 0x555556384b90
  },
  font_driver_list = 0x0,
  desired_cursor = FILLED_BOX_CURSOR,
  cursor_width = 0,
  blink_off_cursor = FILLED_BOX_CURSOR,
--Type <RET> for more, q to quit, c to continue without paging--
  blink_off_cursor_width = 0,
  config_scroll_bar_width = 0,
  config_scroll_bar_cols = 0,
  config_scroll_bar_height = 0,
  config_scroll_bar_lines = 0,
  cost_calculation_baud_rate = 0,
  alpha = {0, 0},
  alpha_background = 0,
  gamma = 0,
  extra_line_spacing = 0,
  background_pixel = 18446744073709551613,
  foreground_pixel = 18446744073709551614
}
(gdb) p f->root_window
$9 = XIL(0x555556439025)
(gdb) p f->root_window->contents
There is no member named contents.
(gdb) p ((struct window*)f->root_window)->contents
$10 = XIL(0x7f)
(gdb) xpr
Lisp_Float
Cannot access memory at address 0x78
(gdb) p ((struct window*)f->selected_window)->contents
$11 = XIL(0x7f)
(gdb) xpr
Lisp_Float
Cannot access memory at address 0x78
(gdb)

In GNU Emacs 30.0.50 (build 8, x86_64-pc-linux-gnu) of 2024-06-09 built
 on sonn
Repository revision: 19806248167b9c4edaadbf4ed428a62fd8c5e412
Repository branch: master
System Description: Devuan GNU/Linux 5 (daedalus)

Configured using:
 'configure --prefix=/opt/dc/emacs/ --with-tiff=no --without-tiff
 --without-libsystemd --without-dbus --with-mailutils
 --with-native-compilation --with-x-toolkit=no --without-imagemagick
 --without-xft --without-harfbuzz --without-freetype --without-libotf
 --without-xwidgets --without-xpm --without-jpeg --without-gif
 --without-png --without-webp --without-rsvg --without-cairo --without-x
 --enable-checking=yes,glyphs 'CFLAGS=-g3 -O0''

Configured features:
GMP GNUTLS LCMS2 LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER SECCOMP SOUND SQLITE3 THREADS XIM ZLIB

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

Major mode: Dired by name

Minor modes in effect:
  server-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  line-number-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 sort hashcash mail-extr compile comint ansi-osc ansi-color ring
tool-bar comp-run comp-common rx emacsbug message mailcap yank-media
puny rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date subr-x mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils pp
dired-aux cl-loaddefs cl-lib regexp-opt dired dnd dired-loaddefs
term/rxvt term/xterm xterm byte-opt gv bytecomp byte-compile server rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select 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 lcms2 multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 79456 11259) (symbols 48 7266 2) (strings 32 19563 4524)
 (string-bytes 1 555520) (vectors 16 9518)
 (vector-slots 8 101651 9432) (floats 8 33 11518)
 (intervals 56 2220 0) (buffers 984 14))