]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mworker: disable SIGPROF on re-exec
authorWilly Tarreau <w@1wt.eu>
Mon, 26 Aug 2019 08:37:39 +0000 (10:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 26 Aug 2019 08:44:48 +0000 (10:44 +0200)
If haproxy is built with profiling enabled with -pg, it is possible to
see the master quit during a reload while it's re-executing itself with
error code 155 (signal 27) saying "Profile timer expired)". This happens
if the SIGPROF signal is delivered during the execve() call while the
handler was already unregistered. The issue itself is not directly inside
haproxy but it's easy to address. This patch disables this signal before
calling execvp() during a master reload. A simple test for this consists
in running this little script with haproxy started in master-worker mode :

     $ while usleep 50000; do killall -USR2 haproxy; done

This fix should be backported to all versions using the master-worker
model.

src/haproxy.c

index 4d58c532168c23c03df12ea7b9f3a429a705e014..c490cead8b02387e7de5d52021ccd77e89e0f4e9 100644 (file)
@@ -695,6 +695,7 @@ void mworker_reload()
        }
 
        ha_warning("Reexecuting Master process\n");
+       signal(SIGPROF, SIG_IGN);
        execvp(next_argv[0], next_argv);
 
        ha_warning("Failed to reexecute the master process [%d]: %s\n", pid, strerror(errno));