﻿# Immediate failed-host TCP closure can occupy Envoy's event loop

Envoy's explicit failed-host connection closure is scoped to tcp_proxy. Review connection count and unrelated progress before using it as a recovery action.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/envoy-health-failure-existing-connections/
Language: en

## The recovery action becomes observable work

A TCP-proxy upstream fails health checks while many long-lived sessions remain attached. An operator enables immediate closure of failed-host connections to avoid retaining bad sessions. The closure itself can occupy processing time and delay unrelated traffic.

The [cluster API reference](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/cluster/v3/cluster.proto) documents close_connections_on_host_health_failure and warns about spending substantial time closing many connections. Treat this as an explicit recovery action with resource cost, not a free consequence of changing an endpoint label.

## Keep the TCP-proxy scope explicit

The field is documented as supported for connections created by tcp_proxy. Do not extend that statement into a universal HTTP stream-management contract or infer behavior for another filter merely because it uses the same cluster.

Record the actual listener filter, upstream cluster and effective setting. Connection pooling and multiplexed request handling have their own contracts. A count of accepted application requests is not automatically the number of raw TCP sessions that this action will close.

## Identify the triggering transition

The [outlier-detection overview](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/outlier) describes marking an ejected host unhealthy. Active health checks can also supply host-health transitions. Preserve the actual trigger and the endpoint identity alongside the closure event.

Do not conflate removing a host from service discovery, marking it unhealthy and terminating its established sessions. Those are distinct observations. A service-recovery record should show which event caused closure and which session population was attached at that moment.

## Account for the closure burst

Capture established-session counts, closure timing and unrelated proxy progress over a common interval. Keep retrying downstream clients visible: closing sessions can cause reconnection work that adds to the original cleanup burst.

Use a bounded disposable connection fixture rather than generating uncontrolled reconnection pressure against a live upstream. Compare the intended policy with the relevant existing-session behavior, preserving per-session outcomes and the time during which other traffic is delayed.

## Acceptance for the recovery policy

Accept immediate closure when it achieves the intended release of failed-host sessions and the proxy's remaining service meets its stated interruption tolerance. Record abandoned application operations explicitly. A closed transport does not establish whether an earlier remote action committed.

[Accepted-work termination](/journal/provider-graceful-termination-active-streams/) explains the separate classification of active operations. [Health decision roles](/journal/provider-startup-readiness-liveness-separation/) explains why a health observation and the action following it must be reviewed together.

## Avoid transferring the guarantee to another protocol

This policy does not promise graceful completion or safe automatic replay. Nor does the documented caveat prove that every deployment will experience a measurable stall; that depends on its session population and implementation. Preserve the actual filter scope and observed workload. The useful result is a qualified failure-response action whose cleanup cost is visible, rather than an assumption that immediate session removal cannot affect the rest of the proxy.
