unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 33034@debbugs.gnu.org
Subject: bug#33034: `unwind-protect' cleanup form is not executed if body dies in stack overflow
Date: Sat, 13 Oct 2018 12:52:13 +0200	[thread overview]
Message-ID: <CAG7BparJpp=Y9kZX_8=AsRSFP+ROg7GpJTTTCM1ZSO7WQD2KFg@mail.gmail.com> (raw)
In-Reply-To: <83in26unu5.fsf@gnu.org>

I haven't looked into the source code, but it seems that these
examples don't involve C-level stack overflow.  I tried setting
`attempt-stack-overflow-recovery' to nil and re-evaluated the examples
with exactly the same results: cleanup forms are not executed, but
Emacs doesn't crash. Looks like stack that is overflown here is only
Lisp-level. Besides, it's hard to imagine that `max-specpdl-size' or
`max-lisp-eval-depth' somehow affect C-level stack.

On Sat, 13 Oct 2018 at 12:45, Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Paul Pogonyshev <pogonyshev@gmail.com>
> > Date: Sat, 13 Oct 2018 12:35:46 +0200
> > Cc: 33034@debbugs.gnu.org
> >
> > I see. Wonderful approach.
>
> If you have ideas for better approaches, I'm sure they will be
> welcome.
>
> C stack overflow results in SIGSEGV; the current code attempts
> recovery by using OS-dependent techniques that analyze the data
> provided by the segfault to detect when it's a stack overflow, and if
> so, do the moral equivalent of (throw 'top-level), bypassing any
> possible unwind forms, because evaluating those forms when there is no
> available stack space might very well trigger another, nested
> segfault.
>
> It's a hard problem, and the only justification for it is to give
> users some imperfect chance of saving their edits.
>
> Some people think we shouldn't even attempt to recover from such
> calamities, and instead just crash, which is why we have the
> attempt-stack-overflow-recovery variable to let those people have what
> they want.





  reply	other threads:[~2018-10-13 10:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-13 10:07 bug#33034: `unwind-protect' cleanup form is not executed if body dies in stack overflow Paul Pogonyshev
2018-10-13 10:29 ` Eli Zaretskii
2018-10-13 10:35   ` Paul Pogonyshev
2018-10-13 10:45     ` Eli Zaretskii
2018-10-13 10:52       ` Paul Pogonyshev [this message]
2018-10-13 11:01         ` Eli Zaretskii
2018-10-13 11:29           ` Eli Zaretskii
2018-10-13 11:38             ` Paul Pogonyshev
2018-10-13 12:35               ` Eli Zaretskii
2018-10-13 14:02                 ` Paul Pogonyshev
2018-10-14 17:02 ` Paul Eggert

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='CAG7BparJpp=Y9kZX_8=AsRSFP+ROg7GpJTTTCM1ZSO7WQD2KFg@mail.gmail.com' \
    --to=pogonyshev@gmail.com \
    --cc=33034@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).