Repository navigation
Description
Description:
The shutdown manager’s HTTP server configures WriteTimeout: 10s, while its /shutdown/ready handler can wait substantially longer for /tmp/shutdown-ready.
For example, configuring spec.shutdown.drainTimeout: 165s generates --ready-timeout=175s. If the marker appears after the HTTP write deadline, the handler detects readiness but the client can receive an empty response instead of HTTP 200.
Expected behavior: the endpoint returns HTTP 200 when the marker appears within readyTimeout, or its HTTP error response when that timeout expires.
Relevant implementation:
Suggested fix:
Extend the write deadline specifically for /shutdown/ready using http.NewResponseController(w).SetWriteDeadline(...) before polling begins. Set it to readyTimeout plus sufficient allowance for the final polling interval and response transmission, for example 5 seconds. Other endpoints can retain the existing server write timeout.
Previous closed, unmerged PRs address the same problem:
- #10186: endpoint-specific write deadline and real HTTP regression tests.
- #10074: server-wide write timeout adjustment.
Repro steps:
-
Start the shutdown manager from the unmodified
envoyproxy/gateway:v1.10.0image with an empty, writable/tmp:envoy-gateway envoy shutdown-manager --ready-timeout=175s
-
Once
/healthzresponds, send a request from a client that can reach the manager:curl --http1.1 --max-time 40 -v \ http://<manager>:19002/shutdown/ready
-
Approximately 20 seconds after the request starts, create the marker in the manager’s filesystem:
touch /tmp/shutdown-ready
-
Observe the client response and manager logs.
Use a fresh manager process and initially absent marker for each run.
Observed results:
| Marker created after | Request duration | Result |
|---|---|---|
| Approximately 2 seconds | 2.06 seconds | HTTP 200 |
| Approximately 20 seconds | 20.11 seconds | curl exit code 52; no HTTP response |
Environment:
- Envoy Gateway: v1.10.0
- Image:
envoyproxy/gateway:v1.10.0 - Container platform: Linux AMD64, running through Apple Container on macOS
- Shutdown manager:
--ready-timeout=175s - Client protocol: HTTP/1.1
- Envoy proxy: not started; this reproduction exercises the shutdown manager independently
- Kubernetes: not required for this reproduction
Logs:
Client output for the approximately 20-second case:
curl: (52) Empty reply from server
Corresponding shutdown-manager log messages:
06:43:08.439 received shutdown ready request
06:43:28.510 shutdown readiness detected
No Envoy access logs are produced because the request goes directly to the shutdown manager.
Activity