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: Eli Zaretskii <eliz@gnu.org>
Cc: n142857@gmail.com, 71223@debbugs.gnu.org
Subject: bug#71223: 30.0.50; stack overflow after very fast opening and closing of frames
Date: Mon, 27 May 2024 13:49:24 -0400	[thread overview]
Message-ID: <jwvsey3cfu6.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <86a5kbuvq5.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 27 May 2024 18:21:06 +0300")

>> > +(defun server--sit-for (proc seconds)
>> > +  "Like `sit-for', but disable filter of process PROC and don't redisplay."
>> > +  (let ((orig-filter (process-filter proc)))
>> > +    (unwind-protect
>> > +        (progn
>> > +          (set-process-filter proc nil)
>> > +          (sit-for seconds t))
>> > +      (set-process-filter proc orig-filter))))
>> 
>> Hmm... (set-process-filter proc nil) means that any process output will
>> be sent to the process's buffer rather than to the filter, which doesn't
>> sound right (it will make us miss that process output, basically).
>> 
>> If we want this to work well we need to store the process output we
>> receive during the `sit-for` and call the process filter in it afterwards.
>
> At this point we don't expect any output from the process, and if it
> comes, don't want to know about it nor process it.

Why don't we want to process it?
[ I understand why we don't want to process it *now* but why wouldn't
  we want to process it later?  ]

>> Another option would be to offer a way to temporary suspend the
>> reception of process output for a specific process.  For most processes,
>> suspending reception of process output while running the process filter
>> would be the right thing to do, so even better would be to do that
>> automatically and offer instead a way for a process filter to explicitly
>> enable running itself recursively when/were it is needed.
> The problem here is that the process filter calls sit-for, which reads
> process output, which also calls the process filter, etc., etc. -- a

That was my understanding, indeed.  But that seems to contradict:

    At this point we don't expect any output from the process, and if it
    comes, don't want to know about it nor process it.

Oh... wait I think I understand: it's the same process-filter but not
the same process.  So your `set-process-filter` won't make
a difference and my suggestion to suspend reception of this process's
output won't help either.

>> We should devise a variant of `message` which guarantees that the message
>> is shown for at least N seconds but without having to wait for the
>> N seconds to pass before running the rest of the code.
> AFAIU, 'message' is not the problem, the problem is not to delete the
> process object too quickly, because that causes all kinds of
> unpleasant effects on the client side (see the bug reports related to
> changes in these areas).

In this specific case, it seems the relevant execution path goes through
one of the other `sit-for`, indeed.  But in theory the same could happen
with this `sit-for` so it would be good to get rid of it as well.

>> I think a better option here is to run the `delete-process` from
>> a timer, so we can *really* return immediately.
> Then, in the scenario of this bug report, we could have large amounts
> of processes we haven't chance to delete yet, because timers were not
> run before the next connection starts.

Sure.  I don't see why that would be a problem, tho.


        Stefan






  reply	other threads:[~2024-05-27 17:49 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 [this message]
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

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=jwvsey3cfu6.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=71223@debbugs.gnu.org \
    --cc=eliz@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).