Subject: Re: bug#50284: 28.0.50; Emacs crashes occasionally on macOS BigSur

From: Eli Zaretskii <[email-masked]>
Date: Thu, 30 Sep 2021 12:17:48 +0300

> From: Umar Ahmad <[email-masked]>
> Date: Thu, 30 Sep 2021 02:14:06 +0530
> Cc: Eli Zaretskii <[email-masked]>, [email-masked]
> 
> Anyway, I think you're right to point out that it was some lisp code that was
> the culprit here. I've been running emacs continuously for the last 20 days
> without a crash. This closely matches the time I upgraded all the packages, so I
> think it's fair to assume that some package upgrade solved it.
> 
> I was under the assumption that any lisp code crashing emacs would be a bug in
> Emacs, but I guess we can keep this closed, considering that I can't replicate
> it now.

A Lisp bug shouldn't in general crash Emacs, but infinite recursion in
Lisp is an exception: it is not always possible to recover from that,
although Emacs does try.

> > We need to know where in regex-emacs.c is the place shown in the last line
> above.  Can you try establishing that?
> 
> I've no idea on how to establish that considering my rudimentary knowledge of
> C. Do you mean, running emacs with GDB enabled and adding breakpoints to figure
> this out?

It is enough to run under GDB and produce a backtrace when the crash
happens.

> > This indicates that you are using s.el, which makes tracking this bug harder.
> 
> Oh! I see. Didn't know this could make things harder.

It is harder because to try anything we would need to install s.el.

> > So I think we need to see the full Lisp backtrace when this happens, or at
> least the Lisp code which runs.
> 
> Got it. I only knew of `toggle-debug-on-error`, at the time of reporting this
> bug, that would give me a trace if there were some errors in elisp but I didn't
> know, how I could've managed to get the lisp trace when emacs crashes. I just
> discovered the /etc/DEBUG file, after going through your mail, and it seems the
> way to do this is again through GDB and running xbacktrace. Is this the correct
> understanding or is there some other way to achieve this?

Yes.  In fact, if you start GDB from the src directory with Emacs
sources, the "backtrace" command will automatically run "xbacktrace"
as well, because we arrange for that in src/.gdbinit.

So I guess we should close this bug for now?