A client request made it past Envoy’s routing, established a TCP connection to an upstream host, and then the connection died before the response completed. The access log shows a UC or UPE response flag, upstream_rq_rx_reset is climbing, and the client received a 502 or 503.
This is a different failure class from “no healthy upstream” (503, NR flag) or “connection refused” (503, UF flag). Those happen before a connection is established. Resets happen after the handshake succeeds, which means the upstream was reachable and then failed during request processing. The diagnosis and fix are completely different.
Operators often call these “502 errors,” but Envoy’s response code depends on when and why the reset happened. Most of these are actually 503s with a UC flag, not 502s. A true 502 requires a UPE flag (protocol error). The distinction matters because UC points to the upstream process or network path, while UPE points to a protocol mismatch.
What this means
Envoy tracks two reset counters that tell you who initiated the teardown:
upstream_rq_rx_reset: the upstream sent the reset. Envoy received a RST from the remote side. This fires when the upstream process crashes, restarts, closes an idle connection out from under Envoy, sends an HTTP/2 RST_STREAM, or sends a GOAWAY frame. A companion counter,upstream_rq_rx_reset_no_error, distinguishes graceful resets (HTTP/2 GOAWAY with NO_ERROR) from error-driven RSTs.upstream_rq_tx_reset: Envoy itself reset the upstream connection. This fires when a circuit breaker trips, a local timeout expires, or the overload manager intervenes. The upstream did not initiate this failure, Envoy did.
The response code the client sees depends on the timing and cause of the reset:
| Reset timing | Who reset | Typical code | Flag | Response code detail |
|---|---|---|---|---|
| Before response headers | Upstream (RST or close) | 503 | UC | upstream_reset_before_response_started{connection_termination} |
| Before response headers | Protocol error from upstream | 502 | UPE | upstream_reset_before_response_started{protocol_error} |
| Before response headers | Envoy (circuit breaker) | 503 | UO | circuit breaker overflow detail |
| After response headers started | Upstream (RST or close) | truncated response | UC | upstream_reset_after_response_started{remote reset} |
The UC flag returns 503. A true 502 from this path requires the UPE flag, which fires when the upstream sends malformed protocol data. If your dashboards label all of these as “502s,” you are likely looking at 503s with UC flags.
flowchart TD
A["Envoy sends request to upstream"] --> B{"Reset before response headers?"}
B -- "Yes, upstream RST or close" --> C["rx_reset increments
503 UC (connection_termination)
or 502 UPE (protocol_error)"]
B -- "Yes, Envoy local reset" --> D["tx_reset increments
503 with local flag
(circuit breaker, timeout, overload)"]
B -- "No" --> E{"Reset after headers started?"}
E -- "Yes, upstream resets mid-response" --> F["rx_reset increments
Downstream gets truncated response
rq_reset_after_downstream_response_started"]
E -- "No" --> G["Response completes normally"]Metrics gap to know about. When a reset occurs before response headers are received, Envoy sends a local reply to the client but does not increment the upstream_rq_2xx / upstream_rq_5xx cluster HTTP response code counters. The reset is captured in upstream_rq_rx_reset or upstream_rq_tx_reset, but not in the per-status-code breakdown. . If your error-rate dashboards rely solely on upstream_rq_5xx, they will undercount these failures. Always correlate with the reset counters.
Common causes
| Cause | What it looks like | First thing to check |
|---|---|---|
| Backend deploy or restart | Spike in rx_reset during a known deployment window, self-resolving in minutes | Check deployment timestamps against the reset spike |
| Idle timeout mismatch | Low, steady rx_reset rate, no deploy correlation, UC flag in access logs | Compare Envoy’s idle_timeout to the upstream’s keepalive timeout |
| Upstream crash or OOM | Sudden rx_reset spike correlated with upstream process restarts | Check upstream container/process logs for OOM or crash |
| Protocol error | 502 UPE in access logs, upstream_reset_before_response_started{protocol_error} | Check for HTTP/2 framing issues, header size limits, response format changes |
| Circuit breaker trip | tx_reset spike, UO flag, circuit_breakers.*.cx_open = 1 | Check upstream_cx_active vs max_connections |
| Upstream timeout | tx_reset spike, UT flag, upstream_rq_timeout incrementing | Check upstream_rq_time histogram for tail latency growth |
| Network MTU or path issue | Sporadic rx_reset, no clear pattern, possibly cross-AZ | Check for path MTU changes, firewall rule updates |
| mTLS renegotiation failure | Sporadic rx_reset with ssl.connection_error correlation | Check certificate rotation events and SDS state |
Quick checks
All commands below query the Envoy admin API (read-only). Ensure the admin port is not exposed outside localhost.
# rx_reset and tx_reset rates for a specific cluster
curl -s http://localhost:9901/stats | grep -E 'cluster\.my_cluster\.upstream_rq_(rx_reset|tx_reset|total)'
# Connection-level reset context (stream reset vs full connection teardown)
curl -s http://localhost:9901/stats | grep -E 'upstream_cx_destroy_(remote|local)_with_active_rq'
# Circuit breaker state (rules out tx_reset from breaker trips)
curl -s http://localhost:9901/stats | grep 'circuit_breakers'
# Timeout stats (rules out tx_reset from local timeouts)
curl -s http://localhost:9901/stats | grep -E 'upstream_rq_(timeout|per_try_timeout)'
# Upstream health (rules out host-level failure)
curl -s http://localhost:9901/stats | grep -E 'membership_healthy|membership_total'
# TLS errors on the upstream path (rules out mTLS issues)
curl -s http://localhost:9901/stats | grep 'ssl\.'
# Reset ratio: take two samples 10s apart and compute delta_rx_reset / delta_upstream_rq_total
In Istio sidecar mode, the admin port is 15000, not 9901. The health endpoint is on port 15021 at /healthz/ready.
How to diagnose it
Compute the reset ratio. Divide
upstream_rq_rx_reset(orupstream_rq_tx_reset) byupstream_rq_totalover the same window. The absolute count is meaningless without traffic context. A ratio above 0.001 (0.1%) sustained on a healthy cluster warrants investigation. During deploys, short spikes to 1-5% are common and self-resolving.Determine who is resetting. If
rx_resetis climbing, the upstream is tearing down connections. Iftx_resetis climbing, Envoy is tearing them down locally. These have different root causes and different fixes. Check both counters.Check the access log response flags.
UCconfirms upstream-initiated termination.UOpoints to a circuit breaker.UTpoints to a timeout.UPEpoints to a protocol error. Multiple flags can be set simultaneously (for example,UC,URXmeans the upstream closed and retries were exhausted). Response flags are access-log only, they are not exposed as aggregate Prometheus stats.Check the response code detail string. If your access log format includes
%RESPONSE_CODE_DETAILS%, look forupstream_reset_before_response_started{connection_termination}vs{protocol_error}. This string tells you the exact reset reason. For protocol errors, the detail may be opaque, showing only{protocol_error}without the underlying cause.Correlate with connection-level stats. Check
upstream_cx_destroy_remote_with_active_rqalongsideupstream_rq_rx_reset. If both spike together, the upstream is killing entire connections with active requests, not just individual streams. This points to process-level failure (crash, OOM, restart) rather than per-request issues.Check timing against events. Correlate the reset spike with deployment timestamps, certificate rotation events, upstream scaling events, and network infrastructure changes. Most
rx_resetspikes during deploys are expected and self-resolve.Rule out the upstream being genuinely broken. Check
upstream_rq_timefor latency shifts,upstream_cx_connect_failfor connectivity issues, andmembership_healthyfor host ejection. If the upstream is slow or failing health checks, resets are a symptom, not the root cause.
Metrics and signals to monitor
| Signal | Why it matters | Warning sign |
|---|---|---|
upstream_rq_rx_reset | Upstream-initiated resets (RST, close, GOAWAY with error) | Sustained ratio above 0.1% of upstream_rq_total |
upstream_rq_tx_reset | Envoy-initiated resets (circuit breaker, timeout, overload) | Any sustained nonzero rate |
upstream_rq_rx_reset_no_error | Distinguishes graceful GOAWAY from error resets | Should be small relative to rx_reset |
upstream_cx_destroy_remote_with_active_rq | Connection-level remote reset with active requests | Spike alongside rx_reset means connection teardown, not stream reset |
upstream_cx_destroy_local_with_active_rq | Connection-level local reset with active requests | Spike alongside tx_reset confirms Envoy-initiated teardown |
upstream_rq_timeout | Overall request timeout exceeded | Correlated with tx_reset and UT flag |
upstream_rq_per_try_timeout | Per-attempt timeout exceeded | Correlated with tx_reset, retry behavior |
circuit_breakers.*.cx_open | Connection circuit breaker tripped | Nonzero means Envoy is fast-failing, causing tx_reset |
Response flag UC in access logs | Confirms upstream connection termination | Any sustained rate on production traffic |
Response flag UPE in access logs | Confirms upstream protocol error (the actual 502 cause) | Any nonzero rate indicates protocol mismatch |
rq_reset_after_downstream_response_started | Reset after downstream response began (truncated response) | Critical for gRPC streaming and long-poll workloads |
Fixes
rx_reset from backend deploys or restarts
The most common and usually least concerning cause. During a rolling deploy, old upstream instances receive SIGTERM and close active connections. Envoy sees these as resets. If the deploy is graceful and new instances come up quickly, the spike resolves on its own.
If the spike is sustained or customer-visible, check whether the upstream sends a graceful shutdown signal (HTTP/2 GOAWAY) that lets Envoy drain before closing. Without GOAWAY, Envoy has no warning before the RST arrives. Consider adding retry-on-reset policy if the deploy window is brief and the requests are idempotent.
rx_reset from idle timeout mismatch
Envoy holds idle upstream connections in its pool for reuse. If the upstream closes idle connections faster than Envoy expects (for example, the upstream’s keepalive timeout is 30s but Envoy’s idle_timeout is 60s), Envoy will occasionally send a request on a connection the upstream is about to close or has already closed. This produces a low, steady rate of rx_reset with no deploy correlation.
Fix: align the timeouts. Envoy’s upstream idle_timeout should be shorter than the upstream’s keepalive timeout so Envoy closes the connection first. This is a common source of sporadic 1-in-100k reset errors.
rx_reset from upstream crash or OOM
If the upstream process is crashing or getting OOM-killed, the resets are a symptom. Check the upstream’s own logs and metrics, not Envoy’s. Envoy is correctly reporting that the connection died. The fix is in the upstream: address the memory leak, resource exhaustion, or crash bug.
tx_reset from circuit breaker trips
When tx_reset correlates with circuit_breakers.*.cx_open = 1 or rq_pending_open = 1, Envoy is resetting upstream connections because it hit a configured limit. The response flag is UO. This is Envoy protecting itself and the upstream from overload.
Do not reflexively increase the circuit breaker limits. The circuit breaker is a symptom of the upstream being slow or the pool being undersized. Check upstream_rq_time for latency growth and upstream_cx_active against max_connections. If the upstream is genuinely slow, fix the upstream. If the limits are genuinely too low for normal traffic, then adjust the limits. See the circuit breaker guide for detailed triage.
tx_reset from timeouts
When tx_reset correlates with upstream_rq_timeout or upstream_rq_per_try_timeout, the upstream did not respond within the configured timeout window and Envoy gave up. The response flag is UT. Check whether the timeout is appropriate for the workload and whether the upstream’s latency distribution has shifted. A per-try timeout (x-envoy-upstream-rq-per-try-timeout-ms) fires per attempt, while the overall request timeout covers all retries combined.
Mid-response resets (truncated responses)
When the upstream resets after response headers have started flowing downstream, the client receives a partial or truncated response. There is no clean HTTP status code for this case because headers were already sent. This is particularly damaging for gRPC streaming, SSE, and long-poll workloads.
The router filter tracks these via rq_reset_after_downstream_response_started. Monitor this counter separately for streaming workloads. The access log detail is upstream_reset_after_response_started{remote reset}. The root causes are the same as pre-header resets (crash, deploy, network issue), but the user impact is worse because the client has already started consuming the response.
Prevention
Align idle timeouts. Set Envoy’s upstream
idle_timeoutlower than the upstream’s keepalive timeout. This eliminates the most common source of sporadic baseline resets.Configure retry-on-reset policy. The router filter’s retry policies cover disconnects and resets. The
5xxpolicy retries on disconnect, reset, and read timeout. Theresetpolicy retries on any disconnect, reset, or read timeout specifically. Thegateway-errorpolicy covers 502, 503, 504 plus disconnect/reset. Configure retries only for idempotent requests, and set a per-try timeout so retries have time to complete within the overall request budget.Alert on reset ratio, not absolute count. Alert on
upstream_rq_rx_reset / upstream_rq_totalexceeding a threshold (for example, 0.5% sustained for 5 minutes with a meaningful traffic floor). Absolute counts are meaningless without traffic context.Include
%RESPONSE_FLAGS%and%RESPONSE_CODE_DETAILS%in access logs. Without these fields, you cannot distinguish aUCreset from aUOcircuit breaker trip from aUPEprotocol error. These are the single most important debugging signals Envoy provides for this failure class.Track protocol errors separately. A
502 UPEis a different problem from a503 UC. Protocol errors point to upstream format changes, header size violations, or HTTP/2 framing issues.
Monitoring with Netdata
Per-second reset counters show exactly when
upstream_rq_rx_resetorupstream_rq_tx_resetbegins climbing, at the granularity needed to correlate with deploy events, upstream latency shifts, or circuit breaker state changes.Computed reset ratios (
rx_reset / upstream_rq_total,tx_reset / upstream_rq_total) as derived metrics, so alerts fire on proportional impact rather than absolute counts that scale with traffic.Baseline-aware alerting on the reset ratio distinguishes a deploy-correlated spike (expected) from a genuine trend shift, reducing alert noise during routine rollouts.
Correlation with connection-level stats (
upstream_cx_destroy_remote_with_active_rq,upstream_cx_active,circuit_breakers.*_open) in a single timeline view, shortening the path from “resets are up” to “the upstream is killing connections” or “the circuit breaker is tripping.”Upstream latency histograms (
upstream_rq_time) alongside reset counters, to determine whether resets correlate with slow upstreams (backend degradation) or occur independently (crashes, deploys, timeout mismatches).
Related guides
- Envoy circuit breaker open: cx_open, rq_pending_open, and fast-failed requests
- Envoy connection pool exhaustion: a slow upstream that fills the pool
- Envoy health checks vs outlier detection: two systems that eject hosts differently
- How Envoy actually works in production: a mental model for operators
- Envoy membership_healthy dropping: reading the single most important cluster signal
- Envoy monitoring checklist: the signals every production proxy needs
- Envoy monitoring maturity model: from survival to expert
- Envoy no healthy upstream: the 503 when a cluster has no host to route to
- Envoy outlier detection mass ejection: when passive health checks empty a cluster
- Envoy panic threshold: why traffic routes to unhealthy hosts at 50%
- Envoy connection churn: a low reuse ratio and keepalive misconfiguration
- Envoy upstream_cx_active near max_connections: the pool filling up






