HAProxy community

Stick tables and reloads

I restart haproxy on configuration changes using a command like:

haproxy -L $PEERNAME -f /etc/haproxy/haproxy.cfg -p $PIDFILE -D -sf $(cat $PIDFILE)

and I’ve mostly gotten stick tables working, using information from the request to determine the sticky session.

However, during a reload, sessions seem to not be using the correct server for a short period of time. The documentation on peers states:

during a soft restart, the old process connects to the new one
using such a TCP connection to push all its entries before the new process
tries to connect to other peers… it typically takes a fraction of a second even for large tables

the table is not very large, but I wonder if during that fraction of a second, requests are getting routed to the wrong server.

I would hope that the new process doesn’t accept connections until after it has finished reading the state from the old process. But I can’t think of any other reason for this behavior, and the documentation isn’t super clear on this.

Has anyone else run into this? Or know how to ensure stickiness is preserved even during reloads?

Can you file a bug about this with all the details: