New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server goes UP without tcp-check if it resolves again #51
Comments
|
What are the settings in your |
|
|
It's ok that it changes IP, because a new istance exists. It's not normal that haproxy sets it as UP before do it the tcp-check and respect the rise parameter... |
|
It is expected behavior that a new servers are actually by default up, not down, before the first health check is done. This of course does not work with the configuration you are using, because here you are basically misusing the health check system for application master/slave logic - which is not the use-case it's designed for. I can see how it would be useful to be able to configure the default state for new servers coming from DNS though. @bedis any opinion about this? |
|
I dont understand how this is possible... If the server is DOWN first of all it should follow the "rise" parameter logic before go UP.. No? |
|
Servers are UP by default. When health checks are not used, all servers are UP. When health checks are used, but did not start yet or the status is not yet determined, then the current server status will be UP. This is documented and expected behavior. "rise" is about health check behavior. Not about pre health-check behavior. |
|
We wanted to have an "init-state {up|down}" setting a while ago when developing the server-template stuff, and we figured that "init-addr none" already covered that so it was not implemented. But here is an example where it proves this is not the case. While we were originally focused on the server state when the process starts, we didn't think about the state once the server has an address again. I'm wondering if it's a resolver thing or a status thing. I don't know what happens when we set an IP on a server from the CLI, does it automatically go up. If not then we could address this by an extra resolver option. If it does, it's a wider thing to address : we need to set the server state after it is assigned an address. |
|
From what I'm seeing in the code, the resolver sets the server into the maintenance state, which makes sense and matches what appears in Luca's logs above. So what puts the server UP is that it leaves maintenance mode. After all being able to configure this state when leaving maintenance is more general and not specific to the resolver. For instance, an admin who disabled a server for an upgrade could want it to start with checks first when turning it back on. The code responsible for this is in srv_update_status(), in this block : I'm seeing that we already support switching out of maintenance to the down or starting state, it's the case when the server tracks another one, in which case it'll turn to this other server's state. So for me this proves that all the logic to handle the transition exists and is safe to reuse. Thus we could have this "init-state" config element to change this behaviour. I'm tagging this as a good first issue in case someone is interested in jumping into this development which seems quite accessible to me. |
|
I'm hitting the same issue. My use case is for often-changing cloud infrastructure in AWS:
Brief excerpt from haproxy.cfg: |
|
I find this behavior very annoying too. I think that assuming a server is UP without performing the healthcheck is not a good thing. |


Hi to all, I have a problem with a haproxy instance (1.9.4) in front of a redis cluster (3 nodes), all inside k8s.
I configured haproxy for a tcp-check like this:
When the master node goes down it works fine, a replica is promoted to master and haproxy redirects the traffic to that.
The problem is when the old master comes back with a new ip, because haproxy doesn't check again for the master role but instead it puts immediately the old node as UP.
this is the log:
If you see last lines, when the bk_redis/redis-0 has a new ip (BUT IT WAS DOWN) it goes immediately UP without do the tcp-check (that it start after a second and of course it fails).
How can I avoid this ?
Is there a way to force that when it resolves again the ip it waits for the tcp-check for go UP ?
The text was updated successfully, but these errors were encountered: