You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.4 KiB

  1. commit f259fcc00a04e633a7a64f894a719f78f3644867
  2. Author: Willy Tarreau <w@1wt.eu>
  3. Date: Mon Aug 26 10:37:39 2019 +0200
  4. BUG/MINOR: mworker: disable SIGPROF on re-exec
  5. If haproxy is built with profiling enabled with -pg, it is possible to
  6. see the master quit during a reload while it's re-executing itself with
  7. error code 155 (signal 27) saying "Profile timer expired)". This happens
  8. if the SIGPROF signal is delivered during the execve() call while the
  9. handler was already unregistered. The issue itself is not directly inside
  10. haproxy but it's easy to address. This patch disables this signal before
  11. calling execvp() during a master reload. A simple test for this consists
  12. in running this little script with haproxy started in master-worker mode :
  13. $ while usleep 50000; do killall -USR2 haproxy; done
  14. This fix should be backported to all versions using the master-worker
  15. model.
  16. (cherry picked from commit e0d86e2c1caaaa2141118e3309d479de5f67e855)
  17. Signed-off-by: Willy Tarreau <w@1wt.eu>
  18. diff --git a/src/haproxy.c b/src/haproxy.c
  19. index f6f00fc1..c93b0d13 100644
  20. --- a/src/haproxy.c
  21. +++ b/src/haproxy.c
  22. @@ -695,6 +695,7 @@ void mworker_reload()
  23. }
  24. ha_warning("Reexecuting Master process\n");
  25. + signal(SIGPROF, SIG_IGN);
  26. execvp(next_argv[0], next_argv);
  27. ha_warning("Failed to reexecute the master process [%d]: %s\n", pid, strerror(errno));