Hi Olivier, On Tue, Dec 17, 2019 at 09:20:21AM +0100, Olivier D wrote: > That's not what I was saying. I'm already using "show server state", and > that's exactly what leads me to hours of debugging : between two versions > of my haproxy config file, I changed backend server port from 80 to 443. > When HAProxy reloaded, it loaded server state file and loaded both the > previous state(up/down) of the server, but also the server port. That's why > HAProxy never used port 443 as backend port and was still using old port 80. > This is not clearly stated in the configuration (or maybe I missed it ?), > that's why I was asking whether it is an expected behaviour. In my mind, > the server state was only used to get server status between two reload, not > more informations.
Bah, state-file strikes again :-( We predicted exactly this when it was designed. Some people complain that their changes are lost and others that their changes are kept. We discussed this already with Baptiste and we figured that the only solution to this is to change the format to include, for each and every field, *both* the config config state and the current state, so that upon reload, the state file parser can detect what changed from previous running instance: if the config changed, you want the config change to be taken into account. If the config didn't change, then very likely you want to keep the previous state. It's a really tricky thing because most of the time a reload is made in order to apply a change, but this change may conflict with what is in the state file in a way that's not that determinist :-/ Personally I don't like the idea of having two authoritative sources for a single configuration, which is why we must make this state file processing stricter and its contents more detailed. It's worth noting that some people are already abusing it by writing their changes directly to the state file and avoid touching the config (typically just have a server-template directive in the config and all the details in the state file). This shows how tricky the situation can become every time we try to address one's needs and break someonee else's :-/ Willy

