unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Daniel Clemente <n142857@gmail.com>
Cc: 71223@debbugs.gnu.org
Subject: bug#71223: 30.0.50; stack overflow after very fast opening and closing of frames
Date: Wed, 29 May 2024 15:56:17 -0400	[thread overview]
Message-ID: <jwvfru0tndx.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAJKAhPDk9y+sFcajjBj6o6p+-CKpWAf4W2+h1uzQtcC07Fh8BA@mail.gmail.com> (Daniel Clemente's message of "Wed, 29 May 2024 10:54:47 +0000")

>> Could you try the patch below which sequentializes the processing of the
>> process-filters to avoid such recursion?
>
> Running on d9512da49514623ef3e35524dc894c06f2c0ce20 (from yesterday)
> with only this patch, and a simple loop (10 seconds are enough):
>
> for j in `seq 10`; do for i in `seq 10`; do urxvt -e emacsclient '-nw'
> '-e' '(dired "~")' &; done; sleep 1 && killall emacsclient; done
>
> (gdb) run --fg-daemon -Q
> Starting program: /opt/dc/emacs/bin/emacs --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 1028]
> [Detaching after vfork from child process 1033]
> [Detaching after vfork from child process 1034]
> process server <5> no longer connected to pipe; closed it
> Process server <6> not running: connection broken by remote peer

AFAICT this is because you kill those processes with `killall
emacsclient` so when Emacs finally wants to send the "result" back, the
`process-send-string` fails with the above error.

IOW, I'm not sure it reflects a bug in Emacs.

> At that point, it's unresponsive and I can't open new emacsclient.
> They open a black window, where after a time I see "Server not
> responding". If I wait until all the "connection broken" errors slowly
> end, then these frames will load (i.e. dired is visible), and new
> frames will load too.

Actually, if you hit a key within the Emacs frame you presumably have
opened, it should finish those things without waiting (the 2s waits are
done with `sit-for` which waits only when there's no pending user input).

> With casual usage, i.e. just opening a few frames and closing them
> after they are fully loaded (visible text inside) there are no
> "connection broken" messages. I think the error appears only when I'm
> closing a frame that was still in the process of being opened.

IIUC this problem is not really new with my code (tho, I guess when the
process-filters are run in a nested fashion, the various `sit-for` can
be done in parallel, whereas with my patch they are done sequentially,
significantly increasing the visible delay when you have many such
requests).

The better solution is to eliminate the remaining `sit-for`s (e.g. using
some new `message-timed` function which displays a message during at
least N seconds but returns immediately), of course.


        Stefan






  reply	other threads:[~2024-05-29 19:56 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 [this message]
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

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=jwvfru0tndx.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=71223@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=n142857@gmail.com \
    /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).