[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33034: `unwind-protect' cleanup form is not executed if body dies in

From: Paul Pogonyshev
Subject: bug#33034: `unwind-protect' cleanup form is not executed if body dies in stack overflow
Date: Sat, 13 Oct 2018 16:02:09 +0200

(defvar global-test nil)
    (let ((global-test t))
      (message "inside, global-test = %s" global-test)
      (error "test"))
  (message "in cleanup, global-test = %s" global-test))

This gives the following output (outside the error):
    inside, global-test = t
    in cleanup, global-test = nil

So, global variables are unwound, but stack is not? This doesn't make
much sense to me.

Besides, what is the purpose of current implementation? Current state
has at least one disadvantage, highlighted by this bug: cleanup forms
after a stack overflow error always fail to work, because stack is
still full. Are there any advantages? I feel like it is more of
coincidence than deliberate decision. Would fixing it break backwards
On Sat, 13 Oct 2018 at 14:35, Eli Zaretskii <address@hidden> wrote:
> > From: Paul Pogonyshev <address@hidden>
> > Date: Sat, 13 Oct 2018 13:38:11 +0200
> > Cc: address@hidden
> >
> > OK, but why does it hit the limit? Logically, by the time cleanup form
> > is called, all the (overflow) stack frames should be removed and the
> > cleanup form should see practically empty stack. It shouldn't be much
> > different from calling cleanup without overflowing the stack to begin
> > with.
> I don't think your expectation, that the stack should be unwound
> before the cleanup runs, is correct.  The implementation calls the
> cleanup forms before it jumps to top-level, and I see nothing in the
> documentation to promise anything different.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]