bug#43066: Hang when forking new process.

Ludovic Courtès <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
Hi Mathieu,

Mathieu Othacehe <[email protected]> skribis:

>>From 004c0c78c9c21c48b38d76b5d7b356b40c8e5a4a Mon Sep 17 00:00:00 2001
> From: Mathieu Othacehe <[email protected]>
> Date: Thu, 27 Aug 2020 09:16:55 +0200
> Subject: [PATCH] Close finalization pipe after forking.
>
> When forking, the finalization pipe file descriptors are
> inherited. If the child process spawns a finalization thread, it will
> use a copy of its parent finalization pipe file descriptors.
>
> Hence, if the parent tries to stop its finalization thread, by forking
> another process for instance, it may stop the child finalization thread
> and hang forever for its own finalization thread to stop.
>
> Fix it by closing the finalization pipe file descriptor copies in the
> child right after forking and opening a new pipe by calling
> scm_init_finalizer_thread.
>
> * libguile/finalizers.c (scm_i_finalizer_post_fork): New function.
> * libguile/finalizers.c (scm_i_finalizer_post_fork): Declare it.
> * libguile/posix.c (scm_fork): Call it in the child process, right after forking.

Apologies for overlooking this patch!

This was fixed differently in 5a281e35f4a5ae78fbcf10591d9358bec8f0bee0,
which is in 3.0.7.

Thanks,
Ludo’.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.