GNU bug report logs - #31995
Condition-case can't catch C stack overflow

Previous Next

Package: emacs;

Reported by: Sheng Yang (杨圣) <yangsheng6810 <at> gmail.com>

Date: Thu, 28 Jun 2018 17:02:02 UTC

Severity: normal

Tags: wontfix

Found in version 26.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #15 received at 31995 <at> debbugs.gnu.org (full text, mbox):

From: Sheng Yang (杨圣) <yangsheng6810 <at> gmail.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 31995 <at> debbugs.gnu.org
Subject: Re: bug#31995: 26.1; Condition-case failed to catch error
Date: Wed, 11 Jul 2018 22:46:21 -0700
[Message part 1 (text/plain, inline)]
condition-case was able to catch C stack overflow before commit
f0a1e9ec. I understand that recovering from C stack overflow is magical
and can be tricky, but emacs is capable of this thanks to all of your
efforts. The only part missing is re-throwing this as a lisp exception,
which should not be as hard as recovering from C stack overflow.

Here is why this feature can be important. When we open a file,
find-file-hook will call many functions, including but not limited to
undo-tree. These functions read additional files (undo-tree, project
file, dir-local, etc.) and perform tasks. To guard against file
corruption and other problems, all reads are wrapped in some try-catch
clause. However, the trust in these try-catch clauses are let down, and
a single file corruption (or a file that can cause C stack overflow)
ruins the whole process of loading file with a mysterious message
of"Recovered from C stack overflow". I don't think this is acceptable.

From a lisp programmer's perspective, if exceptions should occur, they
should be caught. This is exactly the behavior that condition-case and
other try-catch clause promise.

I am not an expert in C, debugging the C part of emacs can be painful
for me. Therefore I bisected and found the offending commits (see my
original bug report). Hope this can help you pin point the problem and
fix the bug.

On 07/11/2018 02:48 PM, Noam Postavsky wrote:
> retitle 31995 Condition-case can't catch C stack overflow
> tags 31995 + wontfix
> quit
>
> Sheng Yang (杨圣) <yangsheng6810 <at> gmail.com> writes:
>
>> It seems that the function call ~(read (current-buffer))~ causes C stack
>> overflow. Though I personally believe the undo-tree file is not
>> corrupted, I assume this error should be caught by condition-case even
>> if the file to read is indeed corrupted.
> The file is not corrupted, it's just that the recursion goes too deep
> during reading.  However, I don't think condition-case can reasonably
> catch C stack overflow.  As it is, recovering from C stack overflow at
> all is a bit controversial, which is why we have the
> attempt-stack-overflow-recovery variable which you can set to nil in
> order to reliably segfault instead.

-- 
Sheng Yang(杨圣)
PhD student
Computer Science Department
University of Maryland, College Park
E-mail:yangsheng6810 <at> gmail.com

[Message part 2 (text/html, inline)]

This bug report was last modified 5 years and 325 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.