[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can Emacs deal with segfaults more gracefully (on Mac)
From: |
Eli Zaretskii |
Subject: |
Re: Can Emacs deal with segfaults more gracefully (on Mac) |
Date: |
Fri, 02 Aug 2024 08:55:09 +0300 |
> From: Ag Ibragimov <agzam.ibragimov@gmail.com>
> Date: Thu, 01 Aug 2024 17:18:55 -0500
>
> After a lengthy hiatus, I am having to work on Mac again. Almost immediately,
> I stumbled on a problem with crashing Emacs. Long story short (you can read
> all about it here
> https://www.reddit.com/r/emacs/comments/1eg9hdg/multilingual_spellchecking_omg_what_a_rabbit_hole),
> it turned out that a package calls a command-line utility that segfaults in
> certain cases. This isn't a quest to help me with the problem; I identified
> and found a workaround for it.
>
> It did make me wonder, though, why did Emacs crash to begin with? Shouldn't
> it be handling offending subprocesses more gracefully? I think, typically,
> Emacs (I think) would handle subprocess errors gracefully; my guess is that
> in this specific case, the error was too severe, or something like that?
Emacs should never crash because a subprocess crashed. But AFAIU in
your case it is not a subprocess that crashed, it's a dynamic module,
i.e. a shared library loaded by Emacs. Because that's how jinx is
implemented: it is a dynamic Emacs module that uses the Enchant
_library_ (not Enchant the program) to perform the spell-checking.
When a shared library loaded by Emacs segfaults, the fatal signal is
delivered to Emacs itself, and Emacs cannot possibly continue to run.
What Emacs does in this case is catch the fatal signal and attempt to
auto-save before exiting, so as to at least save your edits. But exit
it must in this case; there's no way around that.
> Also, I just realized - Emacs almost never (at least I don't remember when
> that happened to me last time) crashes in Linux. On Mac, it does. Can't say
> quite often, yet occasionally, that happens.
>
> I'm just curious; is that due to how Emacs runs on Macs, or for some other
> reasons?
That is unrelated, but yes, Emacs on macOS is less stable, mainly
because we don't have experts on board who can invest time into
maintaining the macOS port.