net-proxy/haproxy init script designed to handle reload with custom user function *reload_seamless* the default reload command is still run anyway where *reload_seamless* is present or not. Reproducible: Always Steps to Reproduce: 1. create reload_seamless function to call custom code to reload the haproxy 2. run /etc/init.d/haproxy reload 3. Actual Results: function reload_seamless is executed default reload command is executed as well Expected Results: only reload_seamless should be executed moreover default "reload" command RESTARTs haproxy indeed
Hi Deniss, is the reload_seamless hook even required nowadays? For HAProxy itself it's not, actually. Wouldn't be a pre/post hook be enough? Like already possible, you can have your own pre/post reload function. Why do you think it actually *restarts* HAProxy? It does not in the shipped version.
reload does "$command $command_args -sf $(cat "${pidfile}")" from haproxy man: -sf <pidlist> Send FINISH signal to the pids in pidlist after startup. The processes which receive this signal will wait for all sessions to finish before exiting. note "before exiting" in text above
There should be a way to skip default command in reload() func that force haproxy process to exit. for sure it is possible to call exit inside reload_seamless but it feels hacky
You're not using master-worker mode, don't you? Can you show me your custom function by chance? I'm curious whether it's still required at all.
net-proxy/haproxy-3.0.8 reload_seamless() { kill -s USR2 $(cat /run/haproxy.pid) exit $? } master-worker mode is a default mode in the init script: command_args="-D -W -p ${pidfile} ${configs} ${HAPROXY_OPTS}" I run with following config : # grep HAPROXY_OPTS /etc/conf.d/haproxy HAPROXY_OPTS="-S /run/haproxy-master.sock" # head -9 /etc/haproxy/haproxy.cfg global daemon maxconn 262144 user haproxy ssl-server-verify none log /dev/log local0 debug defaults mode http
Created attachment 920760 [details] haproxy.initd-r9 Can you please try this init script? Does that solve your problem entirely?
looks fine to me
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ff48e295842df204280fb58b4e20de8b1c215aa commit 0ff48e295842df204280fb58b4e20de8b1c215aa Author: Christian Ruppert <idl0r@gentoo.org> AuthorDate: 2025-03-20 15:45:54 +0000 Commit: Christian Ruppert <idl0r@gentoo.org> CommitDate: 2025-03-20 15:46:11 +0000 net-proxy/haproxy: Bump to 3.0.9 and 3.1.6; Also send USR2 on reload Bug: https://bugs.gentoo.org/950574 Signed-off-by: Christian Ruppert <idl0r@gentoo.org> net-proxy/haproxy/Manifest | 2 + net-proxy/haproxy/files/haproxy.initd-r9 | 86 ++++++++++++ net-proxy/haproxy/haproxy-2.6.9999.ebuild | 4 +- net-proxy/haproxy/haproxy-2.8.9999.ebuild | 4 +- net-proxy/haproxy/haproxy-2.9.9999.ebuild | 4 +- net-proxy/haproxy/haproxy-3.0.9.ebuild | 217 ++++++++++++++++++++++++++++++ net-proxy/haproxy/haproxy-3.0.9999.ebuild | 4 +- net-proxy/haproxy/haproxy-3.1.6.ebuild | 216 +++++++++++++++++++++++++++++ net-proxy/haproxy/haproxy-3.1.9999.ebuild | 4 +- net-proxy/haproxy/haproxy-9999.ebuild | 4 +- 10 files changed, 533 insertions(+), 12 deletions(-)
Should be fixed then. Thanks! :)