GNU bug report logs - #57699
Assertion failure "lib_child_handler != dummy_handler"

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Fri, 9 Sep 2022 14:41:02 UTC

Severity: normal

Tags: patch

Merged with 57934

Found in version 29.0.50

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57699 in the body.
You can then email your comments to 57699 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#57699; Package emacs. (Fri, 09 Sep 2022 14:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 09 Sep 2022 14:41:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: Assertion failure "lib_child_handler != dummy_handler"
Date: Fri, 09 Sep 2022 10:40:09 -0400
[Message part 1 (text/plain, inline)]
Tags: patch

Tags: patch

Tags: patch

Recently on my Debian testing machines, my Emacs built with assertion
checks crash at startup with:

    process.c:8441: Emacs fatal error: assertion failed: lib_child_handler != dummy_handler

The patch below seems to fix it, but I have no idea if it's the right
thing to do.


        Stefan


In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnux32, GTK+ Version 3.24.34, cairo version 1.16.0)
 of 2022-07-19 built on alfajor
Repository revision: 1c7aefa0c5327803f32aebbdf7cfed8d21f65f96
Repository branch: work
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure -C --enable-checking --enable-check-lisp-object-type --with-modules --with-cairo --with-tiff=ifavailable
 'CFLAGS=-Wall -g3 -Og -Wno-pointer-sign'
 PKG_CONFIG_PATH=/home/monnier/lib/pkgconfig'

[lib_child_handler.patch (text/patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57699; Package emacs. (Fri, 09 Sep 2022 15:00:02 GMT) Full text and rfc822 format available.

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

From: Robert Pluim <rpluim <at> gmail.com>
To: 57699 <at> debbugs.gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#57699: Assertion failure "lib_child_handler != dummy_handler"
Date: Fri, 09 Sep 2022 16:59:05 +0200
>>>>> On Fri, 09 Sep 2022 10:40:09 -0400, Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> said:

    Stefan> Tags: patch
    Stefan> Tags: patch

    Stefan> Tags: patch

    Stefan> Recently on my Debian testing machines, my Emacs built with assertion
    Stefan> checks crash at startup with:

    Stefan>     process.c:8441: Emacs fatal error: assertion failed: lib_child_handler != dummy_handler

    Stefan> The patch below seems to fix it, but I have no idea if it's the right
    Stefan> thing to do.

EEMPTYPATCH

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57699; Package emacs. (Fri, 09 Sep 2022 15:28:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 57699 <at> debbugs.gnu.org
Subject: Re: bug#57699: Assertion failure "lib_child_handler != dummy_handler"
Date: Fri, 09 Sep 2022 11:27:07 -0400
[Message part 1 (text/plain, inline)]
> EEMPTYPATCH

Hmm... not sure how that happened.
Let's try again.


        Stefan
[lib_child_handler.patch (text/x-diff, inline)]
diff --git a/src/process.c b/src/process.c
index 7a133cda00f..331f7daf83e 100644
--- a/src/process.c
+++ b/src/process.c
@@ -8438,11 +8438,15 @@ init_process_emacs (int sockfd)
       catch_child_signal ();
       g_source_unref (source);
 
-      eassert (lib_child_handler != dummy_handler);
-      signal_handler_t lib_child_handler_glib = lib_child_handler;
-      catch_child_signal ();
-      eassert (lib_child_handler == dummy_handler);
-      lib_child_handler = lib_child_handler_glib;
+      /* Apparently more recent versions of glib do not set this handler
+         any more, so make sure the dance is needed before going for it.  */
+      if (lib_child_handler != dummy_handler)
+        {
+          signal_handler_t lib_child_handler_glib = lib_child_handler;
+          catch_child_signal ();
+          eassert (lib_child_handler == dummy_handler);
+          lib_child_handler = lib_child_handler_glib;
+        }
 #else
       catch_child_signal ();
 #endif

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57699; Package emacs. (Fri, 09 Sep 2022 17:14:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Robert Pluim <rpluim <at> gmail.com>, Paul Eggert <eggert <at> cs.ucla.edu>,
 57699 <at> debbugs.gnu.org
Subject: Re: bug#57699: Assertion failure "lib_child_handler != dummy_handler"
Date: Fri, 09 Sep 2022 19:13:10 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> -      eassert (lib_child_handler != dummy_handler);
> -      signal_handler_t lib_child_handler_glib = lib_child_handler;
> -      catch_child_signal ();
> -      eassert (lib_child_handler == dummy_handler);
> -      lib_child_handler = lib_child_handler_glib;
> +      /* Apparently more recent versions of glib do not set this handler
> +         any more, so make sure the dance is needed before going for it.  */
> +      if (lib_child_handler != dummy_handler)
> +        {
> +          signal_handler_t lib_child_handler_glib = lib_child_handler;
> +          catch_child_signal ();
> +          eassert (lib_child_handler == dummy_handler);
> +          lib_child_handler = lib_child_handler_glib;

Perhaps Paul has some comments here; added to the CCs.




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Fri, 09 Sep 2022 21:28:01 GMT) Full text and rfc822 format available.

Notification sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
bug acknowledged by developer. (Fri, 09 Sep 2022 21:28:02 GMT) Full text and rfc822 format available.

Message #19 received at 57699-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Lars Ingebrigtsen <larsi <at> gnus.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 57699-done <at> debbugs.gnu.org, Robert Pluim <rpluim <at> gmail.com>
Subject: Re: bug#57699: Assertion failure "lib_child_handler != dummy_handler"
Date: Fri, 9 Sep 2022 16:27:43 -0500
On 9/9/22 12:13, Lars Ingebrigtsen wrote:
> Perhaps Paul has some comments here; added to the CCs.

Stefan's patch looks good so I installed it (with my comments :-).

At some point Emacs should probably use the superior method of clone3 
with CLONE_PIDFD and waitid if available, so that it can avoid the 
hackery and races entailed by SIGCHLD.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57699; Package emacs. (Sun, 11 Sep 2022 11:39:01 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: 57699 <at> debbugs.gnu.org
Cc: eggert <at> cs.ucla.edu, monnier <at> iro.umontreal.ca
Subject: Re: bug#57699: Assertion failure "lib_child_handler != dummy_handler"
Date: Sun, 11 Sep 2022 14:38:29 +0300
[Message part 1 (text/plain, inline)]
Paul Eggert via "Bug reports for GNU Emacs, the Swiss army knife of text editors" [2022-09-09 16:27 -0500] wrote:

> On 9/9/22 12:13, Lars Ingebrigtsen wrote:
>> Perhaps Paul has some comments here; added to the CCs.
>
> Stefan's patch looks good so I installed it (with my comments :-).

Thanks.

Building emacs-28 on Debian fails with the same fatal error:

[emacs-28.txt.gz (application/gzip, attachment)]
[Message part 3 (text/plain, inline)]
Can the fix be backported?

-- 
Basil

$ pkg-config --modversion glib-2.0
2.73.3
$ gcc --version
gcc (Debian 12.2.0-1) 12.2.0
$ uname -a
Linux tia 5.19.0-1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.19.6-1
(2022-09-01) x86_64 GNU/Linux

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57699; Package emacs. (Sun, 11 Sep 2022 11:49:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: eggert <at> cs.ucla.edu, monnier <at> iro.umontreal.ca, 57699 <at> debbugs.gnu.org
Subject: Re: bug#57699: Assertion failure "lib_child_handler != dummy_handler"
Date: Sun, 11 Sep 2022 14:47:34 +0300
> Cc: eggert <at> cs.ucla.edu, monnier <at> iro.umontreal.ca
> Date: Sun, 11 Sep 2022 14:38:29 +0300
> From:  "Basil L. Contovounesios" via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> > Stefan's patch looks good so I installed it (with my comments :-).
> 
> Thanks.
> 
> Building emacs-28 on Debian fails with the same fatal error:
> 

Then use the same patch.

> Can the fix be backported?

It's too late for Emacs 28.2, I think, but we can look into
backporting it afterwards.  (I'm not very worried about 28.2, since
I'm sure the distros will pick up the change regardless.)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57699; Package emacs. (Sun, 11 Sep 2022 13:55:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "Basil L. Contovounesios" <contovob <at> tcd.ie>, eggert <at> cs.ucla.edu,
 57699 <at> debbugs.gnu.org
Subject: Re: bug#57699: Assertion failure "lib_child_handler != dummy_handler"
Date: Sun, 11 Sep 2022 09:54:46 -0400
> It's too late for Emacs 28.2, I think, but we can look into
> backporting it afterwards.  (I'm not very worried about 28.2, since
> I'm sure the distros will pick up the change regardless.)

AFAIK they build without assertions, so maybe it'll will "just work"?


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57699; Package emacs. (Sun, 11 Sep 2022 14:52:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, Eli Zaretskii <eliz <at> gnu.org>
Cc: "Basil L. Contovounesios" <contovob <at> tcd.ie>, 57699 <at> debbugs.gnu.org
Subject: Re: bug#57699: Assertion failure "lib_child_handler != dummy_handler"
Date: Sun, 11 Sep 2022 09:51:23 -0500
On 9/11/22 08:54, Stefan Monnier wrote:
> AFAIK they build without assertions, so maybe it'll will "just work"?

Yes, that's my understanding.





Forcibly Merged 57699 57934. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 19 Sep 2022 16:18:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 18 Oct 2022 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 180 days ago.

Previous Next


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