unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Clemente <n142857@gmail.com>
To: 71289@debbugs.gnu.org
Cc: Eli Zaretskii <eliz@gnu.org>
Subject: bug#71289: 30.0.50; cmcheckmagic aborts when tty_write_glyphs writes "Garbage collecting..." in some cases
Date: Fri, 31 May 2024 17:09:29 +0000	[thread overview]
Message-ID: <CAJKAhPC-Xip3gm6WFSdamY09b9O-1h4yeqKSRQaUYk-MceDCUA@mail.gmail.com> (raw)
In-Reply-To: <CAJKAhPB2NU0Xq=tyQWH3CjgtHb8OzVv2azwg9AMj3b_sNHg-_g@mail.gmail.com>

While playing with resizing the urxvt terminal size (X window), I
found other bugs where Emacs doesn't know the real size of the
terminal, or becomes unsynchronized with the actual terminal size.
This may cause many of the other bugs I've seen (things in the style
of: the GC message wants to use 2 minibuffer lines because it thinks
there are 2 lines, but actually there's just 1, etc.).

The two resizing bugs I found (but I don't have time to research them
in detail yet) are:
- if the X terminal has 4 visible rows, FrameRows(tty) reports 4. If
3, then 3. But if it has 2 or 1 rows, Emacs still sees 3. And editing
is garbled
- if I decrease the terminal size fast, e.g. 81→71→61→51→41→31→21→11→1
lines, often Emacs doesn't notice all changes, and it may still report
that FrameRows(tty) is e.g. 31 when it went further down to 1
(31→21→11→1)

- in addition there's a more complex refresh bug (not about resizing I
think), in which the next frame I focus after having killed a frame
won't be refreshed (e.g. I can resize the X window and it doesn't
notice, new sections appear black) until I press a key or move the
mouse. It's 100% reproducible but I need to research this better
because it involves window managers and X

However I didn't see a direct crash from these issues. But maybe a GC
message in some of these conditions can cause the alert.

I may report them as separate bugs but in a while; I'm reporting too
many TTY bugs and too fast; I need time for other things.

I also saw a new type of TTY+GC error (not sure if it's the same issue
as this bug):

alloc.c:7517: Emacs fatal error: assertion failed: t->name != NULL

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  0x000055555573591a in die (msg=0x55555586f838 "t->name != NULL",
file=0x55555586e97e "alloc.c", line=7517) at alloc.c:8082
#2  0x00005555557346e8 in mark_terminals () at alloc.c:7517
#3  0x000055555573276c in garbage_collect () at alloc.c:6603
#4  0x00005555557324b0 in maybe_garbage_collect () at alloc.c:6507
#5  0x000055555576972e in maybe_gc () at /w/emacs/src/lisp.h:5927
#6  0x0000555555770d0f in Ffuncall (nargs=3, args=0x7fffffffcd60) at eval.c:3088
#7  0x000055555576d1f3 in internal_condition_case_n
(bfun=0x555555770be2 <Ffuncall>, nargs=3, args=0x7fffffffcd60,
handlers=XIL(0x30),
    hfun=0x555555770dd8 <safe_eval_handler>) at eval.c:1693
#8  0x0000555555770e96 in safe_funcall (nargs=3, args=0x7fffffffcd60)
at eval.c:3121
#9  0x000055555569992f in timer_check_2 (timers=XIL(0x5555618fec33),
idle_timers=XIL(0x5555618fec93)) at keyboard.c:4680
#10 0x0000555555699fa6 in timer_check () at keyboard.c:4851
#11 0x00005555557ee0d7 in wait_reading_process_output (time_limit=30,
nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=XIL(0),
wait_proc=0x0,
    just_wait_proc=0) at process.c:5429
#12 0x0000555555594f0b in sit_for (timeout=make_fixnum(30),
reading=true, display_option=1) at dispnew.c:6320
#13 0x0000555555695aaf in read_char (commandflag=1,
map=XIL(0x555560403353), prev_event=XIL(0),
used_mouse_menu=0x7fffffffd6df, end_time=0x0)
    at keyboard.c:2923
#14 0x00005555556a705e in read_key_sequence (keybuf=0x7fffffffd8f0,
prompt=XIL(0), dont_downcase_last=false, can_return_switch_frame=true,
    fix_current_buffer=true, prevent_redisplay=false,
disable_text_conversion_p=false) at keyboard.c:10728
#15 0x0000555555691746 in command_loop_1 () at keyboard.c:1429
#16 0x000055555576cf2e in internal_condition_case (bfun=0x555555691317
<command_loop_1>, handlers=XIL(0x90), hfun=0x5555556907c2 <cmd_error>)
    at eval.c:1613
#17 0x0000555555690ef5 in command_loop_2 (handlers=XIL(0x90)) at keyboard.c:1168
#18 0x000055555576c35b in internal_catch (tag=XIL(0xfc60),
func=0x555555690ecb <command_loop_2>, arg=XIL(0x90)) at eval.c:1292
#19 0x0000555555690e87 in command_loop () at keyboard.c:1146
#20 0x0000555555690264 in recursive_edit_1 () at keyboard.c:754
#21 0x0000555555690490 in Frecursive_edit () at keyboard.c:837
#22 0x000055555568bef7 in main (argc=2, argv=0x7fffffffdf18) at emacs.c:2621

Lisp Backtrace:
"Automatic GC" (0x0)
"apply" (0xffffcd68)
(gdb) frame 2
#2  0x00005555557346e8 in mark_terminals () at alloc.c:7517
7517          eassert (t->name != NULL);
(gdb) list
7512    mark_terminals (void)
7513    {
7514      struct terminal *t;
7515      for (t = terminal_list; t; t = t->next_terminal)
7516        {
7517          eassert (t->name != NULL);
7518    #ifdef HAVE_WINDOW_SYSTEM
7519          /* If a terminal object is reachable from a stacpro'ed object,
7520         it might have been marked already.  Make sure the image cache
7521         gets marked.  */
(gdb) p *t
$1 = {
  header = {
    size = -4611686018158710780
  },
  param_alist = XIL(0x555560405553),
  charset_list = XIL(0x7ffff20cc973),
  Vselection_alist = XIL(0),
  glyph_code_table = XIL(0x30),
  next_terminal = 0x5555607377d0,
  id = 89,
  reference_count = 1,
  type = output_termcap,
  name = 0x0,
  kboard = 0x5555613e5290,
  display_info = {
    tty = 0x5555610f7470,
    x = 0x5555610f7470,
    w32 = 0x5555610f7470,
    ns = 0x5555610f7470,
    pgtk = 0x5555610f7470,
    haiku = 0x5555610f7470,
    android = 0x5555610f7470
  },
  terminal_coding = 0x555560fc7090,
  keyboard_coding = 0x5555601bd1c0,
  rif = 0x0,
  cursor_to_hook = 0x55555566caa9 <tty_cursor_to>,
  raw_cursor_to_hook = 0x55555566cb85 <tty_raw_cursor_to>,
  clear_to_end_hook = 0x55555566cc47 <tty_clear_to_end>,
  clear_frame_hook = 0x55555566cd8a <tty_clear_frame>,
  clear_end_of_line_hook = 0x55555566cebf <tty_clear_end_of_line>,
  ins_del_lines_hook = 0x55555566e884 <tty_ins_del_lines>,
  insert_glyphs_hook = 0x55555566e14d <tty_insert_glyphs>,
  write_glyphs_hook = 0x55555566da86 <tty_write_glyphs>,
  delete_glyphs_hook = 0x55555566e5ff <tty_delete_glyphs>,
  ring_bell_hook = 0x55555566b913 <tty_ring_bell>,
  toggle_invisible_pointer_hook = 0x0,
  reset_terminal_modes_hook = 0x55555566be3e <tty_reset_terminal_modes>,
  set_terminal_modes_hook = 0x55555566bb56 <tty_set_terminal_modes>,
  update_begin_hook = 0x0,
  update_end_hook = 0x55555566c11b <tty_update_end>,
  set_terminal_window_hook = 0x55555566c1c2 <tty_set_terminal_window>,
  defined_color_hook = 0x55555567b346 <tty_defined_color>,
  query_frame_background_color = 0x0,
  mouse_position_hook = 0x0,
  get_focus_frame = 0x0,
  focus_frame_hook = 0x0,
  frame_rehighlight_hook = 0x0,
  frame_raise_lower_hook = 0x0,
  frame_visible_invisible_hook = 0x0,
  fullscreen_hook = 0x0,
  iconify_frame_hook = 0x0,
  set_window_size_hook = 0x0,
  set_frame_offset_hook = 0x0,
  set_frame_alpha_hook = 0x0,
  set_new_font_hook = 0x0,
  set_bitmap_icon_hook = 0x0,
  implicit_set_name_hook = 0x0,
  menu_show_hook = 0x555555674ccf <tty_menu_show>,
  popup_dialog_hook = 0x0,
  change_tab_bar_height_hook = 0x0,
--Type <RET> for more, q to quit, c to continue without paging--
  change_tool_bar_height_hook = 0x0,
  set_vertical_scroll_bar_hook = 0x0,
  set_horizontal_scroll_bar_hook = 0x0,
  set_scroll_bar_default_width_hook = 0x0,
  set_scroll_bar_default_height_hook = 0x0,
  condemn_scroll_bars_hook = 0x0,
  redeem_scroll_bar_hook = 0x0,
  judge_scroll_bars_hook = 0x0,
  read_socket_hook = 0x5555556a0938 <tty_read_avail_input>,
  frame_up_to_date_hook = 0x0,
  buffer_flipping_unblocked_hook = 0x0,
  get_string_resource_hook = 0x0,
  delete_frame_hook = 0x555555675a1d <tty_free_frame_resources>,
  delete_terminal_hook = 0x555555677738 <delete_tty>,
  toolkit_position_hook = 0x0
}

(gdb) p *terminal_list
$3 = {
  header = {
    size = -4611686018158710780
  },
  param_alist = XIL(0x55555fee8403),
  charset_list = XIL(0x7ffff20cc973),
  Vselection_alist = XIL(0),
  glyph_code_table = XIL(0x30),
  next_terminal = 0x555560e35800,
  id = 92,
  reference_count = 1,
  type = output_termcap,
  name = 0x55555ff67d90 "/dev/pts/25",
  kboard = 0x55555fae1fd0,
  display_info = {
    tty = 0x555560338010,
    x = 0x555560338010,
    w32 = 0x555560338010,
    ns = 0x555560338010,
    pgtk = 0x555560338010,
    haiku = 0x555560338010,
    android = 0x555560338010
  },
  terminal_coding = 0x55556071ba30,
  keyboard_coding = 0x55555fe518f0,
  rif = 0x0,
  cursor_to_hook = 0x55555566caa9 <tty_cursor_to>,
  raw_cursor_to_hook = 0x55555566cb85 <tty_raw_cursor_to>,
  clear_to_end_hook = 0x55555566cc47 <tty_clear_to_end>,
  clear_frame_hook = 0x55555566cd8a <tty_clear_frame>,
  clear_end_of_line_hook = 0x55555566cebf <tty_clear_end_of_line>,
  ins_del_lines_hook = 0x55555566e884 <tty_ins_del_lines>,
  insert_glyphs_hook = 0x55555566e14d <tty_insert_glyphs>,
  write_glyphs_hook = 0x55555566da86 <tty_write_glyphs>,
  delete_glyphs_hook = 0x55555566e5ff <tty_delete_glyphs>,
  ring_bell_hook = 0x55555566b913 <tty_ring_bell>,
  toggle_invisible_pointer_hook = 0x0,
  reset_terminal_modes_hook = 0x55555566be3e <tty_reset_terminal_modes>,
  set_terminal_modes_hook = 0x55555566bb56 <tty_set_terminal_modes>,
  update_begin_hook = 0x0,
  update_end_hook = 0x55555566c11b <tty_update_end>,
  set_terminal_window_hook = 0x55555566c1c2 <tty_set_terminal_window>,
  defined_color_hook = 0x55555567b346 <tty_defined_color>,
  query_frame_background_color = 0x0,
  mouse_position_hook = 0x0,
  get_focus_frame = 0x0,
  focus_frame_hook = 0x0,
  frame_rehighlight_hook = 0x0,
  frame_raise_lower_hook = 0x0,
  frame_visible_invisible_hook = 0x0,
  fullscreen_hook = 0x0,
  iconify_frame_hook = 0x0,
  set_window_size_hook = 0x0,
  set_frame_offset_hook = 0x0,
  set_frame_alpha_hook = 0x0,
  set_new_font_hook = 0x0,
  set_bitmap_icon_hook = 0x0,
  implicit_set_name_hook = 0x0,
  menu_show_hook = 0x555555674ccf <tty_menu_show>,
  popup_dialog_hook = 0x0,
--Type <RET> for more, q to quit, c to continue without paging--
  change_tab_bar_height_hook = 0x0,
  change_tool_bar_height_hook = 0x0,
  set_vertical_scroll_bar_hook = 0x0,
  set_horizontal_scroll_bar_hook = 0x0,
  set_scroll_bar_default_width_hook = 0x0,
  set_scroll_bar_default_height_hook = 0x0,
  condemn_scroll_bars_hook = 0x0,
  redeem_scroll_bar_hook = 0x0,
  judge_scroll_bars_hook = 0x0,
  read_socket_hook = 0x5555556a0938 <tty_read_avail_input>,
  frame_up_to_date_hook = 0x0,
  buffer_flipping_unblocked_hook = 0x0,
  get_string_resource_hook = 0x0,
  delete_frame_hook = 0x555555675a1d <tty_free_frame_resources>,
  delete_terminal_hook = 0x555555677738 <delete_tty>,
  toolkit_position_hook = 0x0
}
(gdb) p t->terminal_list
There is no member named terminal_list.
(gdb) p t->next_terminal
$4 = (struct terminal *) 0x5555607377d0
(gdb) p (struct terminal*) t->next_terminal
$5 = (struct terminal *) 0x5555607377d0
(gdb) pp (struct terminal*) t->next_terminal
A syntax error in expression, near `'.
(gdb) p (struct terminal*) t->next_terminal
$6 = (struct terminal *) 0x5555607377d0
(gdb) p *((struct terminal*) t->next_terminal)
$7 = {
  header = {
    size = -4611686018158710780
  },
  param_alist = XIL(0x55555fc70803),
  charset_list = XIL(0x7ffff20cc973),
  Vselection_alist = XIL(0),
  glyph_code_table = XIL(0),
  next_terminal = 0x55556066a918,
  id = 27,
  reference_count = 1,
  type = output_termcap,
  name = 0x55555f922a80 "/dev/pts/18",
  kboard = 0x55555f52d030,
  display_info = {
    tty = 0x55555fae8700,
    x = 0x55555fae8700,
    w32 = 0x55555fae8700,
    ns = 0x55555fae8700,
    pgtk = 0x55555fae8700,
    haiku = 0x55555fae8700,
    android = 0x55555fae8700
  },
  terminal_coding = 0x55555e549f50,
  keyboard_coding = 0x55555a6b3d50,
  rif = 0x0,
  cursor_to_hook = 0x55555566caa9 <tty_cursor_to>,
  raw_cursor_to_hook = 0x55555566cb85 <tty_raw_cursor_to>,
  clear_to_end_hook = 0x55555566cc47 <tty_clear_to_end>,
  clear_frame_hook = 0x55555566cd8a <tty_clear_frame>,
  clear_end_of_line_hook = 0x55555566cebf <tty_clear_end_of_line>,
  ins_del_lines_hook = 0x55555566e884 <tty_ins_del_lines>,
  insert_glyphs_hook = 0x55555566e14d <tty_insert_glyphs>,
  write_glyphs_hook = 0x55555566da86 <tty_write_glyphs>,
  delete_glyphs_hook = 0x55555566e5ff <tty_delete_glyphs>,
  ring_bell_hook = 0x55555566b913 <tty_ring_bell>,
  toggle_invisible_pointer_hook = 0x0,
  reset_terminal_modes_hook = 0x55555566be3e <tty_reset_terminal_modes>,
  set_terminal_modes_hook = 0x55555566bb56 <tty_set_terminal_modes>,
  update_begin_hook = 0x0,
  update_end_hook = 0x55555566c11b <tty_update_end>,
  set_terminal_window_hook = 0x55555566c1c2 <tty_set_terminal_window>,
  defined_color_hook = 0x55555567b346 <tty_defined_color>,
  query_frame_background_color = 0x0,
  mouse_position_hook = 0x0,
  get_focus_frame = 0x0,
  focus_frame_hook = 0x0,
  frame_rehighlight_hook = 0x0,
  frame_raise_lower_hook = 0x0,
  frame_visible_invisible_hook = 0x0,
  fullscreen_hook = 0x0,
  iconify_frame_hook = 0x0,
  set_window_size_hook = 0x0,
  set_frame_offset_hook = 0x0,
  set_frame_alpha_hook = 0x0,
  set_new_font_hook = 0x0,
  set_bitmap_icon_hook = 0x0,
  implicit_set_name_hook = 0x0,
  menu_show_hook = 0x555555674ccf <tty_menu_show>,
  popup_dialog_hook = 0x0,
--Type <RET> for more, q to quit, c to continue without paging--
  change_tab_bar_height_hook = 0x0,
  change_tool_bar_height_hook = 0x0,
  set_vertical_scroll_bar_hook = 0x0,
  set_horizontal_scroll_bar_hook = 0x0,
  set_scroll_bar_default_width_hook = 0x0,
  set_scroll_bar_default_height_hook = 0x0,
  condemn_scroll_bars_hook = 0x0,
  redeem_scroll_bar_hook = 0x0,
  judge_scroll_bars_hook = 0x0,
  read_socket_hook = 0x5555556a0938 <tty_read_avail_input>,
  frame_up_to_date_hook = 0x0,
  buffer_flipping_unblocked_hook = 0x0,
  get_string_resource_hook = 0x0,
  delete_frame_hook = 0x555555675a1d <tty_free_frame_resources>,
  delete_terminal_hook = 0x555555677738 <delete_tty>,
  toolkit_position_hook = 0x0
}
(gdb) p t
$8 = (struct terminal *) 0x55556092b4e0
(gdb) p t->next_terminal
$9 = (struct terminal *) 0x5555607377d0
(gdb) p terminal_list
$10 = (struct terminal *) 0x55556146dcc0
(gdb)





  parent reply	other threads:[~2024-05-31 17:09 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-31 10:18 bug#71289: 30.0.50; cmcheckmagic aborts when tty_write_glyphs writes "Garbage collecting..." in some cases Daniel Clemente
2024-05-31 11:17 ` Eli Zaretskii
2024-05-31 17:07   ` Daniel Clemente
2024-05-31 18:17     ` Eli Zaretskii
2024-06-03 15:35       ` Daniel Clemente
2024-06-03 16:21         ` Eli Zaretskii
2024-05-31 17:09 ` Daniel Clemente [this message]
2024-05-31 18:26   ` Eli Zaretskii
2024-06-03 15:56     ` Daniel Clemente
2024-06-03 16:03       ` Eli Zaretskii
2024-06-03 16:28         ` Daniel Clemente
2024-06-03 16:36           ` Eli Zaretskii
2024-06-03 16:51             ` Daniel Clemente
2024-06-03 17:44   ` Eli Zaretskii
2024-06-05 13:51     ` Daniel Clemente
2024-06-06  7:55       ` Eli Zaretskii
2024-06-03 15:36 ` Daniel Clemente
2024-06-03 16:25   ` Eli Zaretskii
2024-06-03 16:55     ` Daniel Clemente
2024-06-03 17:39       ` Eli Zaretskii
2024-06-05 13:50         ` Daniel Clemente
2024-06-05 15:06           ` Eli Zaretskii
2024-06-05 16:43             ` Eli Zaretskii
2024-06-06 12:36               ` Daniel Clemente
2024-06-06 12:34             ` Daniel Clemente
2024-06-06 14:53               ` Eli Zaretskii
2024-06-06 15:23                 ` Daniel Clemente
2024-06-06 16:13                   ` Eli Zaretskii
2024-06-06 16:44                     ` Daniel Clemente
2024-06-06 18:06                 ` Daniel Clemente
2024-06-07  6:11                   ` Eli Zaretskii
2024-06-07  6:42                     ` Daniel Clemente
2024-06-07  6:47                       ` Eli Zaretskii
2024-06-05 13:52     ` Daniel Clemente

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJKAhPC-Xip3gm6WFSdamY09b9O-1h4yeqKSRQaUYk-MceDCUA@mail.gmail.com \
    --to=n142857@gmail.com \
    --cc=71289@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).