Hi Denis,

On Tue, 2021-01-26 at 10:02 +0100, Marcel Holtmann wrote:
Hi Inga,

When an ell main loop based process is spun off as a child
and the parent process dies due to a segfault, the child process
is still left running and needs to detect the segfault condition.
To address this need, add watch and signal handler for SIGSEGV.
ell/main.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/ell/main.c b/ell/main.c
index a479b74..712cfb7 100644
--- a/ell/main.c
+++ b/ell/main.c
@@ -619,6 +619,14 @@ static void sigterm_handler(void *user_data)
		data->callback(SIGTERM, data->user_data);

+static void sigsegv_handler(void *user_data)
+	struct signal_data *data = user_data;
+	if (data->callback)
+		data->callback(SIGSEGV, data->user_data);

actually this is not enough. I never included SIGSEGV here for the simple reason since you have to do a lot of work when that signal happens.

What we need to do is to add proper child spawning handling that does all the nasty signal handling for you. Otherwise you are just about to create zombies. For now if you need child handling, then add your own signal handler instead trying to overload l_main_run_with_signal with it.

We may want to revert this commit. It's harmless, but adds extra code to ell.
There's a way to deal with the segfault situation across the processes without involving ell (thank you Phil for the suggestion).

Sorry for the churn.

Best Regards,