From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Can Emacs deal with segfaults more gracefully (on Mac) Date: Fri, 02 Aug 2024 08:55:09 +0300 Message-ID: <86cymrwjsy.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4232"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Ag Ibragimov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 02 07:56:11 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sZlGt-0000wT-OP for ged-emacs-devel@m.gmane-mx.org; Fri, 02 Aug 2024 07:56:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZlG0-0002FP-2T; Fri, 02 Aug 2024 01:55:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZlFx-0002C8-Pc for emacs-devel@gnu.org; Fri, 02 Aug 2024 01:55:13 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZlFw-0005Or-SB; Fri, 02 Aug 2024 01:55:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=SzKEul3JGwgCOFeqvYj9lyxbbgk4wQa5mmekgcmvRTA=; b=V5T+cp9hUXnI wjSx6yfcgQn4jcFqQE6aJOfZghiD5YjuUUAIrtTGaCoC3WiT/qbUOmMuUIeIAEgMRl8AvqVX6lExK cWqb89JxfIXBNjvkEdnj2kHy8DZSFpPC0ekZv69UMXm+KFsRZW0ewvjSrzEAYHFJV1dNty+8rRDeG x+6wUPSi4W3BrMM/WhW6veLLTChVn3xGnKoR6/h3fJ8nqlOh5r5LY49Rpa+HaUYubYw68bdUxHF3o jaW+9VFb+zdZCT/I1TRwtXjaoOsBXOAqMvw3+wrH1y4PrszdD72HtQgsyf1DqwEMGklX0F4ZvbMko TdDIPcIkUjROowtYOKl/Kg==; In-Reply-To: (message from Ag Ibragimov on Thu, 01 Aug 2024 17:18:55 -0500) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322279 Archived-At: > From: Ag Ibragimov > 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.