From 4de3c74cf21a9958c1cf26d8993c55c6e0d28b49 Mon Sep 17 00:00:00 2001 From: "update-envoy[bot]" <135279899+update-envoy[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2025 16:14:02 +0000 Subject: [PATCH] support backoff between retries in tcp_proxy (#37709) Commit Message: support backoff between retries in tcp_proxy Additional Description: This feature also fixes a bug in the retry mechanism in tcp proxy in the following situation: 1. We are tunneling TCP over HTTP. 2. A new stream is created on existing upstream connection (multiplexing) and waiting for response headers. 3. The upstream connection is closed. 4. During the close process, all streams created on this connection will be reset. 5. The tcp_proxy receives a callback on the stream reset. 6. They retry to connect. 7. The closed connection is picked as it is still in the connection pool (we are still in the process of the close). 8. The new stream that is created on the second attempt will be reset immediately. 9. The same process will happen (step 5 - step 8) until we reach the max_connect_attepts. 10. This means that we are doing only one real attempt in this situation. Risk Level: medium Testing: unit tests, integration tests Docs Changes: added Release Notes: added --------- Signed-off-by: Issa Abu Kalbein Signed-off-by: IssaAbuKalbein <86603440+IssaAbuKalbein@users.noreply.github.com> Co-authored-by: Issa Abu Kalbein Mirrored from https://github.com/envoyproxy/envoy @ 7fa09db1c8cb5e99dc3808d69e7d83276aa9e240 --- .../extensions/filters/network/tcp_proxy/v3/tcp_proxy.proto | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/envoy/extensions/filters/network/tcp_proxy/v3/tcp_proxy.proto b/envoy/extensions/filters/network/tcp_proxy/v3/tcp_proxy.proto index 5a7b011e6..0b6912707 100644 --- a/envoy/extensions/filters/network/tcp_proxy/v3/tcp_proxy.proto +++ b/envoy/extensions/filters/network/tcp_proxy/v3/tcp_proxy.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package envoy.extensions.filters.network.tcp_proxy.v3; import "envoy/config/accesslog/v3/accesslog.proto"; +import "envoy/config/core/v3/backoff.proto"; import "envoy/config/core/v3/base.proto"; import "envoy/config/core/v3/config_source.proto"; import "envoy/type/v3/hash_policy.proto"; @@ -25,7 +26,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE; // TCP Proxy :ref:`configuration overview `. // [#extension: envoy.filters.network.tcp_proxy] -// [#next-free-field: 18] +// [#next-free-field: 19] message TcpProxy { option (udpa.annotations.versioning).previous_message_type = "envoy.config.filter.network.tcp_proxy.v2.TcpProxy"; @@ -211,6 +212,9 @@ message TcpProxy { // giving up. If the parameter is not specified, 1 connection attempt will be made. google.protobuf.UInt32Value max_connect_attempts = 7 [(validate.rules).uint32 = {gte: 1}]; + // Sets the backoff strategy. If not set, the retries are performed without backoff. + config.core.v3.BackoffStrategy backoff_options = 18; + // Optional configuration for TCP proxy hash policy. If hash_policy is not set, the hash-based // load balancing algorithms will select a host randomly. Currently the number of hash policies is // limited to 1.