Commit 8444d3c0 authored by jerome.poulin's avatar jerome.poulin Committed by Jérôme Poulin

Do not update connection count in child handler.

Updating the connection count via systemd in child handler can cause a
deadlock in certain conditions.

(gdb) bt
*0  __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
*1  0x00007f6aa9a5752f in _L_lock_10524 () from /lib/x86_64-linux-gnu/libc.so.6
*2  0x00007f6aa9a5515f in malloc_atfork (sz=140096092768344, caller=<optimized out>) at arena.c:181
*3  0x00007f6aa9ad1427 in __GI___vasprintf_chk (result_ptr=0x7ffe17a2ef18, flags=1,
    format=0x401cf8 "STATUS=Ready. %d connections processed.\n", args=0x7ffe17a2ef20) at vasprintf_chk.c:48
*4  0x00007f6aa9d95428 in sd_notifyf () from /lib/x86_64-linux-gnu/libsystemd.so.0
*5  <signal handler called>
*6  0x00007f6aa9a51792 in ptmalloc_unlock_all () at arena.c:270
*7  0x00007f6aa9a931af in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/x86_64/../fork.c:223
*8  0x0000000000401bba in server_loop ()
*9  0x0000000000401201 in main ()
parent f532b9ae
...@@ -190,7 +190,6 @@ void update_connection_count() ...@@ -190,7 +190,6 @@ void update_connection_count()
/* Handle finished child process */ /* Handle finished child process */
void sigchld_handler(int signal) { void sigchld_handler(int signal) {
while (waitpid(-1, NULL, WNOHANG) > 0); while (waitpid(-1, NULL, WNOHANG) > 0);
update_connection_count();
} }
/* Handle term signal */ /* Handle term signal */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment