Repository navigation
Closed
Labels
Description
Title: New TCP connection pool is not respecting max_connections for circuit-breaker's thresholds
Description:
After upgrading to envoy 1.19 we've been unable to serve more than 1024 downstream TCP connections. This seems to be coming from the new TCP connection pool. We've been able to mitigate this issue by using the older TCP connection pool.
Repro steps:
A detailed repro steps can be found in this gist: https://gist.github.com/aminjam/673aa9a4ed84f018febd7d95d9784bf0
Admin and Stats Output:
N/A
Config:
In summary, the following config.yaml will fail to serve more than 1024 connections as of envoy 1.19
node:
cluster: proxy-cluster
id: my-cluster
static_resources:
secrets:
- name: server_cert
tls_certificate:
certificate_chain:
filename: certs/server.crt
private_key:
filename: certs/server.key
- name: validation_context
validation_context:
trusted_ca:
filename: certs/ca.crt
clusters:
- circuit_breakers:
thresholds:
- max_connections: 4294967295
connect_timeout: 0.250s
load_assignment:
cluster_name: 0-service-cluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 8080
name: 0-service-cluster
type: STATIC
listeners:
- address:
socket_address:
address: 127.0.0.1
port_value: 61001
filter_chains:
- filters:
- name: envoy.tcp_proxy
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
cluster: 0-service-cluster
stat_prefix: 0-stats
transport_socket:
name: listener-8080
typed_config:
'@type': type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
common_tls_context:
alpn_protocols:
- http/1.1
tls_certificate_sds_secret_configs:
- name: server_cert
validation_context_sds_secret_config:
name: validation_context
require_client_certificate: false
name: listener-8080
# uncomment below configuration to see the previous behavior
# layered_runtime:
# layers:
# - name: static-layer
# static_layer:
# envoy:
# reloadable_features:
# new_tcp_connection_pool: false
Logs:
N/A
Call Stack:
N/A
Activity
Switch to using older TCP connection pool
Switch to using older TCP connection pool
ggreenway commentedon Nov 17, 2021
cc @alyssawilk
alyssawilk commentedon Nov 17, 2021
Ah, this is indeed a bug. Because of the shared code, both the max_requests knob is applies as well. The old pool enforced [max_connections, max_pending_requests] and the new enforces [max_connections, max_pending_requests, max_requests]
I'll get a fix out soon to fix the behavioral inconsistency as well as updates to API documentation to make it clear when requests fields apply to connections.
Meanwhile while I've regression tested the workaround I've suggested I'd appreciate you folks confirming it works for you as well. Also if you want to allow unlimited connections you may want to up your allowed pending requests for both the old and new pool!
[-]New TCP connection pool is not respecting max_connections for circuit-breaker's thresholds[/-][+]New TCP connection pool enforcing max_pending_requests[/+][-]New TCP connection pool enforcing max_pending_requests[/-][+]New TCP connection pool enforcing max_requests[/+]Allow unlimited downstream conn
Allow unlimited downstream conn
aminjam commentedon Nov 18, 2021
Thanks @alyssawilk for fixing this issue. We have always used the docker built images to run envoy and we are not setup to build the binaries from the PR branches. Is there a docker image that builds PRs that we could consume? If not, just by looking at the PR and test coverage, it looks like it will fix this issue.
alyssawilk commentedon Nov 23, 2021
I think @ggreenway was going to build a backport so if this didn't miss the window we may be able to get it in
tcp: fix overenthusiastic bounds on the new pool (#19036)
tcp: fix overenthusiastic bounds on the new pool (envoyproxy#19036) (e…
Switch to using older TCP connection pool
Allow unlimited downstream conn