unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Clemente <n142857@gmail.com>
To: 71223@debbugs.gnu.org
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#71223: 30.0.50; stack overflow after very fast opening and closing of frames
Date: Thu, 30 May 2024 11:22:00 +0000	[thread overview]
Message-ID: <CAJKAhPD4DUyx0Pr9zw9159DeCivK=pNQ9AbhsJ4dWd1X51BCbg@mail.gmail.com> (raw)
In-Reply-To: <jwv4jagtjvl.fsf-monnier+emacs@gnu.org>

> Here's a new version of the patch which fixes various shortcomings
> I noticed while trying it out.  Also it shortens the wait times after

Running with d9512da4951 (same as last time, though I enable glyph
debug), and only with this patch.

It seems faster. Messages appear instantly, new frames don't get
stuck. Everything works.

Most importantly, it doesn't overflow the Lisp stack. Immediately
after having opened+closed thousands of frames, I stopped the process
and the stack is small. Opening and closing new frames still works
instantly they work.

Even if I adjust the stress test timings to open+close frame faster
(e.g. sleep 0.5 instead of sleep 1), Emacs does it (slowly, because of
my -O0 build) and they work. My window manager crashed in the process!
(too many windows), but Emacs didn't. The stack is later ok.

I did another experiment which I couldn't do before: 20 minutes
opening+closing frames:
for j in `seq 1200`; do for i in `seq 10`; do urxvt -e emacsclient
'-nw' '-e' '(dired "~")' &; done; sleep 1 && killall emacsclient; done
It didn't hang or crash and I can use emacs normally after that.

Thanks. This simplifies testing and debugging other bugs which only
appear when stressing Emacs (e.g. bug#71176 was like that).

Log of a run, below. The error messages, as Stefan mentioned, are
because of killing emacsclient, and are not a bug. Though some
discussion points remain, about making sure the emacsclient user sees
the errors and the terminal is cleaned. By the way, see the 1 instance
of: Could not open file: /dev/pts/12



Starting program: /opt/dc/emacs/bin/emacs-30.0.50 --fg-daemon -Q
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Starting Emacs daemon.
[Detaching after vfork from child process 4829]
[Detaching after vfork from child process 4830]
[Detaching after vfork from child process 4831]
process server <2> no longer connected to pipe; closed it
Process server <3> not running: connection broken by remote peer

Process server <4> not running: connection broken by remote peer

Process server <5> not running: connection broken by remote peer

Process server <6> not running: connection broken by remote peer

[…]

Process server <38> not running: connection broken by remote peer

Process server <39> not running: connection broken by remote peer

Process server <40> not running: connection broken by remote peer

process server <41> no longer connected to pipe; closed it
process server <42> no longer connected to pipe; closed it
process server <43> no longer connected to pipe; closed it
process server <44> no longer connected to pipe; closed it
process server <45> no longer connected to pipe; closed it
process server <46> no longer connected to pipe; closed it
process server <47> no longer connected to pipe; closed it
Process server <48> not running: connection broken by remote peer

Process server <49> not running: connection broken by remote peer

[…]

Process server <135> not running: connection broken by remote peer

Process server <136> not running: connection broken by remote peer

Process server <137> not running: connection broken by remote peer

Could not open file: /dev/pts/12
process server <139> no longer connected to pipe; closed it
process server <140> no longer connected to pipe; closed it
process server <141> no longer connected to pipe; closed it
process server <142> no longer connected to pipe; closed it
process server <143> no longer connected to pipe; closed it
process server <144> no longer connected to pipe; closed it
process server <145> no longer connected to pipe; closed it
process server <146> no longer connected to pipe; closed it
process server <147> no longer connected to pipe; closed it
Process server <148> not running: connection broken by remote peer

Process server <149> not running: connection broken by remote peer

[…]

Process server <2292> not running: connection broken by remote peer

Process server <2294> not running: connection broken by remote peer

Process server <2293> not running: connection broken by remote peer

Process server <2295> not running: connection broken by remote peer

^Z
Program received signal SIGTSTP, Stopped (user).
pselect64_syscall (sigmask=0x0, timeout=<optimized out>, exceptfds=0x0,
    writefds=0x7fffffffd030, readfds=0x7fffffffd0b0, nfds=11)
    at ../sysdeps/unix/sysv/linux/pselect.c:34
34    ../sysdeps/unix/sysv/linux/pselect.c: No such file or directory.

(gdb) bt

#0  pselect64_syscall (sigmask=0x0, timeout=<optimized out>, exceptfds=0x0,
    writefds=0x7fffffffd030, readfds=0x7fffffffd0b0, nfds=11)
    at ../sysdeps/unix/sysv/linux/pselect.c:34
#1  __pselect (nfds=11, readfds=0x7fffffffd0b0, writefds=0x7fffffffd030,
    exceptfds=0x0, timeout=<optimized out>, sigmask=0x0)
    at ../sysdeps/unix/sysv/linux/pselect.c:56
#2  0x000055555582c5e8 in really_call_select (arg=0x7fffffffcdf0) at
thread.c:624
#3  0x000055555572ffb2 in flush_stack_call_func1 (
    func=0x55555582c54e <really_call_select>, arg=0x7fffffffcdf0) at
alloc.c:5534
#4  0x000055555582b85a in flush_stack_call_func (
    func=0x55555582c54e <really_call_select>, arg=0x7fffffffcdf0)
    at /w/emacs/src/lisp.h:4507
#5  0x000055555582c6a3 in thread_select (func=0x7ffff551d980 <__pselect>,
    max_fds=11, rfds=0x7fffffffd0b0, wfds=0x7fffffffd030, efds=0x0,
    timeout=0x7fffffffd010, sigmask=0x0) at thread.c:656
#6  0x00005555557ee3e1 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:5752
#7  0x0000555555594eb9 in sit_for (timeout=make_fixnum(30), reading=true,
    display_option=1) at dispnew.c:6318
#8  0x0000555555695250 in read_char (commandflag=1, map=XIL(0x7ffff027e153),
    prev_event=XIL(0), used_mouse_menu=0x7fffffffd6af, end_time=0x0)
    at keyboard.c:2923
#9  0x00005555556a67ff in read_key_sequence (keybuf=0x7fffffffd8c0,
    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
#10 0x0000555555690ee7 in command_loop_1 () at keyboard.c:1429
#11 0x000055555576c6cf in internal_condition_case (
    bfun=0x555555690ab8 <command_loop_1>, handlers=XIL(0x90),
    hfun=0x55555568ff63 <cmd_error>) at eval.c:1613
#12 0x0000555555690696 in command_loop_2 (handlers=XIL(0x90)) at keyboard.c:1168
#13 0x000055555576bafc in internal_catch (tag=XIL(0xfc60),
    func=0x55555569066c <command_loop_2>, arg=XIL(0x90)) at eval.c:1292
#14 0x0000555555690628 in command_loop () at keyboard.c:1146
#15 0x000055555568fa05 in recursive_edit_1 () at keyboard.c:754
#16 0x000055555568fc31 in Frecursive_edit () at keyboard.c:837
#17 0x000055555568b698 in main (argc=3, argv=0x7fffffffdee8) at emacs.c:2621
(gdb)





      parent reply	other threads:[~2024-05-30 11:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-27 11:01 bug#71223: 30.0.50; stack overflow after very fast opening and closing of frames Daniel Clemente
2024-05-27 12:23 ` Eli Zaretskii
2024-05-27 12:36   ` Eli Zaretskii
2024-05-27 14:44     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-27 15:21       ` Eli Zaretskii
2024-05-27 17:49         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-27 18:15           ` Eli Zaretskii
2024-05-27 18:33             ` Eli Zaretskii
2024-05-29  0:30               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-29 11:48                 ` Eli Zaretskii
2024-05-29 20:58                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-30  5:12                     ` Eli Zaretskii
2024-05-30 13:40                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-30 15:29                         ` Eli Zaretskii
2024-05-27 15:21     ` Daniel Clemente
2024-05-27 15:26       ` Eli Zaretskii
2024-05-29  0:28 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-29 10:54   ` Daniel Clemente
2024-05-29 19:56     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-30  4:56       ` Eli Zaretskii
2024-05-30 13:35         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-29 21:07   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-30  5:19     ` Eli Zaretskii
2024-05-30 16:09       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-30 16:49         ` Eli Zaretskii
2024-05-30 18:24           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-30 22:39             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-31  5:45               ` Eli Zaretskii
2024-05-31 12:41                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-30 11:22     ` Daniel Clemente [this message]

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='CAJKAhPD4DUyx0Pr9zw9159DeCivK=pNQ9AbhsJ4dWd1X51BCbg@mail.gmail.com' \
    --to=n142857@gmail.com \
    --cc=71223@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).