Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support backoff between retries in tcp_proxy #37709

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

IssaAbuKalbein
Copy link
Contributor

@IssaAbuKalbein IssaAbuKalbein commented Dec 17, 2024

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

Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @adisuissa
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #37709 was opened by IssaAbuKalbein.

see: more, trace.

@IssaAbuKalbein IssaAbuKalbein changed the title support backoff between retries in tcp and udp proxy support backoff between retries in tcp_proxy and udp_proxy Dec 17, 2024
Issa Abu Kalbein and others added 4 commits December 17, 2024 15:07
Signed-off-by: Issa Abu Kalbein <[email protected]>
Signed-off-by: Issa Abu Kalbein <[email protected]>
Signed-off-by: Issa Abu Kalbein <[email protected]>
@IssaAbuKalbein
Copy link
Contributor Author

/retest

Issa Abu Kalbein and others added 2 commits December 19, 2024 15:54
@IssaAbuKalbein
Copy link
Contributor Author

/retest

@IssaAbuKalbein
Copy link
Contributor Author

/retest

Copy link
Contributor

@adisuissa adisuissa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
Left a couple of API comments.
I suggest breaking this down to 2 PRs, one for TCP-Proxy, and the other for UDP-Proxy.

Comment on lines +152 to +159
message RetryOptions {
// The maximum number of unsuccessful connection attempts that will be made before giving up.
// If the parameter is not specified, 1 connection attempt will be made.
google.protobuf.UInt32Value max_connect_attempts = 1;

// Sets the backoff strategy. If not set, the retries are performed without backoff.
config.core.v3.BackoffStrategy backoff_options = 2;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of deprecating the old max_connect_attempts field, I suggest adding the backoff_options directly to the parent's message.
In an ideal world, where all the servers and clients under the control of a single entity, it would probably be possible to refactor the API so fields that are coupled will live in the same sub-type. However, unfortunately in our case, the costs outweigh the benefits, and unless there's a good reason for this refactor, I don't think it adds any new feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this refactor to align tcp_proxy config with udp_proxy, do you still think it will be better to add backoff_options directly to the parent's message?

@adisuissa
Copy link
Contributor

/wait

Signed-off-by: Issa Abu Kalbein <[email protected]>
@IssaAbuKalbein IssaAbuKalbein changed the title support backoff between retries in tcp_proxy and udp_proxy support backoff between retries in tcp_proxy Jan 7, 2025
@IssaAbuKalbein
Copy link
Contributor Author

Thanks! Left a couple of API comments. I suggest breaking this down to 2 PRs, one for TCP-Proxy, and the other for UDP-Proxy.

Created a separate PR for udp_proxy: #37912

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants