[serve] Env-gated observe layer4 mark-down on HAProxy servers - #65267
[serve] Env-gated observe layer4 mark-down on HAProxy servers#65267harshit-anyscale wants to merge 7 commits into
Conversation
Signed-off-by: harshit-anyscale <harshit@anyscale.com>
There was a problem hiding this comment.
Code Review
This pull request introduces configuration options to enable HAProxy's layer 4 error observation, allowing servers to be marked DOWN after consecutive connection failures without waiting for the health checker. The feedback suggests utilizing existing helper functions ('get_env_int_positive' and 'get_env_bool') to parse the new environment variables safely and robustly, which prevents potential startup crashes from invalid integer inputs and ensures consistent boolean parsing.
Signed-off-by: harshit-anyscale <harshit@anyscale.com>
Signed-off-by: harshit-anyscale <harshit@anyscale.com>
Signed-off-by: harshit-anyscale <harshit@anyscale.com>
Signed-off-by: harshit-anyscale <harshit@anyscale.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 168e001. Configure here.
Signed-off-by: harshit-anyscale <harshit@anyscale.com>
Signed-off-by: harshit-anyscale <harshit@anyscale.com>

Summary
When a node is drained (spot reclaim, compaction, scale-down), its displaced (soft-stopped) HAProxy processes keep serving established connections with a frozen config in which torn-down replicas remain nominally UP. Requests those processes accept are black-holed until
hard-stop-afterinstead of failing over. This PR adds an env-gatedobserve layer4 error-limit <N> on-error mark-downto backend replica servers so live traffic itself marks dead servers DOWN and the existingbackupfallback takes over. Default off; the rendered config is byte-identical when unset.Chain of events
-sf) but keeps serving its established connections.nbsrv > 0, so thebackupfallback stays ineligible.hard-stop-after(400s) kills it: queued requests die as 502s (last client failures at drain+401s, to the second), and traffic then flows only to healthy processes.Impact: 8 failed client requests over ~6.5 minutes, exactly on the apps whose replicas all sat on the drained node (echo 1/1 replica, highscale 2/2).
Fix
RAY_SERVE_HAPROXY_OBSERVE_MARK_DOWN_ENABLED(default off) rendersobserve layer4 error-limit <N> on-error mark-down(RAY_SERVE_HAPROXY_OBSERVE_ERROR_LIMIT, default 3) on HTTP and gRPC replica server lines. Connection-level failures observed by live traffic mark the server DOWN synchronously in the request path — verified in HAProxy source:__health_adjust()runs inline with nostoppingguard, and soft-stop does not destroy check tasks, so this works inside displaced processes, the one place nothing else can. With all primaries DOWN,option redispatch+ the existingbackupfallback serve the request. Recovery is automatic: DOWN servers keep being health-probed andrisepasses restore them in ~0.5s, so a false positive self-heals. Backup/fallback servers are never observed; router-path servers inherit state viatrack.