I'm trying to write what amounts to an init/startup script for haproxy with
a patched version of 1.7.8 that includes the seamless reload patches that
are described on this blog post.
https://www.haproxy.com/blog/truly-seamless-reloads-with-
haproxy-no-more-hacks/

#1. If haproxy dies or was killed for some reason the stats socket still
exists, and when you try to relaunch haproxy with the -x option you get
[ALERT] 249/165956 (2750) : Failed to get the sockets from the old process!

It's not impossible, but it's pretty messy to determine if the stats socket
has a valid old process listening on it when trying to relaunch/reload
haproxy.  Is there a solution for this that I'm not seeing?  Otherwise when
you first launch haproxy you have to do so without the -x and then later
have to conditionally include it, and then check to see if you succeeded.

Here's an excerpt from a bash init script as an example of the pain I'm
going through.
unset RELOADSOCK
if [ -e "${STATSFILE}" ] ; then
    RELOADSOCK="-x ${STATSFILE}"
    sudo -u haproxy -g haproxy haproxy -f $HAPROXY_CONFIG_FILE $RELOADSOCK
-p $HAPROXY_PID_FILE -sf $(cat $HAPROXY_PID_FILE)
    if [ $? == 1 ] ; then
        # We likely had difficulty reading the stats file.  Delete it and
run normally.
        rm ${STATSFILE}
        sudo -u haproxy -g haproxy haproxy -f $HAPROXY_CONFIG_FILE -p
$HAPROXY_PID_FILE -sf $(cat $HAPROXY_PID_FILE)
    fi
else
    sudo -u haproxy -g haproxy haproxy -f $HAPROXY_CONFIG_FILE $RELOADSOCK
-p $HAPROXY_PID_FILE -sf $(cat $HAPROXY_PID_FILE)
fi

Other than that, I have seen no ill effects yet when using the -x for
passing, and I can confirm that it has resolved some disconnects.

Thanks,
Dave.
p.s. The above script is not for Ubuntu, but for my day job.

Reply via email to