Repository navigation
Description
Description:
Prerequisites:
- The cluster has a TLS transport socket configured for upstream connections.
- The TLS transport socket references a client certificate via SDS.
- The cluster has active health checking enabled.
All of these must be true for the bug to happen. If removing any of them, the problem goes away.
Control plane (Contour) uses basic xDS with SotW updates (separate gRPC streams for each resource type).
The Problem:
The upstream service is unavailable for certain period of time:
- Scenario 1: The client gets a
503 Service Unavailable"no healthy upstream" error for 4 minutes after Envoy restarts- This is counted from the moment Envoy is back up and ready with all configuration from XDS. It doesn't include the time Envoy takes to be ready serve requests.
- The downtime lasts for
healthy_threshold*no_traffic_interval(for example: 4 * 60s = 4min).
- Scenario 2: The client gets a
503 Service Unavailable"no healthy upstream" error for several seconds after rotating the Envoy client certificate.- The downtime lasts for
healthy_threshold*intervalseconds (for example: 4 * 5s = 20s).
- The downtime lasts for
I don't know exactly which Envoy versions are affected, but this isn't just a problem in the newest code. It's not specific to any recent version.
I do not have a complete understanding of the root cause yet, but the issue appears to be related to the order in which xDS resources are delivered and processed. Envoy handles the request forwarding correctly regardless the delivery order. However, active health checks fail if the SDS secret isn't ready when the cluster and endpoints are created. This happens even if the secrets arrive just a few milliseconds later. It seems there isn't any special retry logic for this. Instead, it just acts like the upstream host is actually down.
My current theory is as follows:
Scenario 1: 4 minutes of unavailability after Envoy restart
Envoy is restarted and it connects to the xDS server to fetch its configuration:
- Cluster is created via CDS with:
- Active health checking enabled
- TLS transport socket with SDS-referenced client certificate
- Cluster endpoints are added via EDS
- Health checker is started
- Endpoints are marked unhealthy because the SDS secret is not yet available
- SDS discovery request is sent by Envoy and the secret is delivered by the control plane
- Cluster enters warming state and it starts sending health check probes
- Upstream respond with success and probes succeed
- Upstream remains unhealthy until
healthy_threshold*no_traffic_interval(for example: 4 * 60s = 4min)
- Cluster becomes healthy and client requests start to succeed
During this time (about 4 minutes) traffic is rejected with 503 Service Unavailable "no healthy upstream".
Note: If triggering a cluster update during this period, then upstream becomes available again immediately.
Scenario 2: 20 seconds of unavailability after client certificate rotation
The cluster is updated with a new SDS secret reference due to certificate rotation:
- Cluster is updated via CDS with
- Active health checking enabled
- TLS transport socket with new SDS reference
- Old cluster is removed and new cluster is created
- There is no EDS update since endpoints remain the same
- Client requests still succeed for a while (~6 seconds but it varies)
- Health checker for new cluster is started
- Endpoints are marked unhealthy because the SDS secret is not yet available
- Client requests start to fail with
503 Service Unavailable"no healthy upstream"
- New SDS secret is delivered
- Cluster re-enters warming state and it starts sending health check probes
- Upstream respond with success and probes succeed
- Upstream remains unhealthy until
healthy_threshold*interval(for example: 4 * 5s = 20s)
- Cluster becomes healthy and client requests start to succeed
During this time (about 20 seconds) traffic is rejected with 503 Service Unavailable "no healthy upstream".
Repro steps:
It's hard to provide steps to reproduce this, as it requires XDS server code. You can find the steps for Contour here: projectcontour/contour#7384.
Admin and Stats Output:
Stats are included in attached logs.
Config:
See the XDS gRPC captures attached below.
Logs:
I'm attaching gRPC captures taken from control plane side of the xDS connection (Contour) using my own capture tool. They can be viewed just as plain json file or with the browser based grpc-json-sniffer app.
- troubleshooting-grpc-capture-certificate-rotation.json xDS message dump, taken from certificate rotation test (traffic disturbance for 20 seconds)
- troubleshooting-logs-certificate-rotation.txt logs, stats etc, taken from certificate rotation test (which caused traffic disturbance)
- troubleshooting-grpc-capture-envoy-restart.json xDS message dump taken after Envoy restart (traffic disturbance for 4 minutes after full configuration has been received by Envoy)
- troubleshooting-grpc-capture-initial-httproxy-creation.json xDS message dump from initial/successful cluster creation (no disturbance)
- troubleshooting-envoy-restart.txt logs (no stats) from Envoy restart (which caused traffic disturbance). These logs have some additional debug prints I've added (lines with
[SDS-DEBUG]prefix)
Activity
tsaarni commentedon Jan 22, 2026
I've been able to avoid the problems by adding a 1-second delay to the health check, but this is of course a hack and not the right fix.
yanavlasov commentedon Jan 23, 2026
Thanks for the analysis. I would think that Envoy should keep clusters in the warming state until SDS config is delivered and not mark endpoints unhealthy before that.
Is this is an issue with just Contour? did you try reaching out to them to see what they might suggest?
@adisuissa ^^^
tsaarni commentedon Jan 23, 2026
I'm maintainer in Contour project myself. I think this applies to any control plane, at least the ones using basic XDS with SotW and use active health check with client secret via SDS.
adisuissa commentedon Jan 23, 2026
+1.
Keeping the clusters in warming state until the secrets are retrieved should probably be the right thing to do. I'm guessing the issue is that the health-checking is performed before the cluster is marked active.
I'm not sure what initiates the health-checking, but I think the first thing is to create a repro integration test based on either eds_integration_test or one of the sds integrations tests (dynamic or static).
tsaarni commentedon Feb 2, 2026
I submitted a draft for suggested fix #43277.
github-actions commentedon Mar 4, 2026
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.
github-actions commentedon Mar 12, 2026
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.
healthcheck: defer health check until cluster finishes warming (#43277)
healthcheck: defer health check until cluster finishes warming (envoy…
healthcheck: defer health check until cluster finishes warming (envoy…
healthcheck: defer health check until cluster finishes warming (envoy…
healthcheck: defer health check until cluster finishes warming (envoy…
healthcheck: defer health check until cluster finishes warming (envoy…