Skip to content

Conversation

@ramaraochavali
Copy link
Contributor

Commit Message: handle idle timeout when connection is not yet established
Additional Description: Handles a case where idle timeout is triggered before a connection is established
Risk Level: Low
Testing: Updated
Docs Changes: N/A
Release Notes: Added
Fixes #42753


void onIdleTimeout() {
host_->cluster().trafficStats()->upstream_cx_idle_timeout_.inc();
close();
Copy link
Contributor

Choose a reason for hiding this comment

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

what's happening if we close a connection which is not established? I wonder what is happening in such case. I believe the close is just ignored

Copy link

@prembhaskal prembhaskal Dec 23, 2025

Choose a reason for hiding this comment

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

That is the bug we are facing #42753 and this fix for bug.
close on a connection not even established is resulting in local connection failure .

agrawroh
agrawroh previously approved these changes Dec 23, 2025
Copy link
Member

@agrawroh agrawroh left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks!

@agrawroh
Copy link
Member

agrawroh commented Dec 23, 2025

/assign @botengyao (Senior Maintainer Review)

@ramaraochavali
Copy link
Contributor Author

/retest

@ramaraochavali
Copy link
Contributor Author

@botengyao not urgent. PTAL when you get chance

Copy link
Member

@botengyao botengyao left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this down! Left a high level comment.

/wait

void onIdleTimeout() {
host_->cluster().trafficStats()->upstream_cx_idle_timeout_.inc();
close();
if (connected_) {
Copy link
Member

Choose a reason for hiding this comment

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

This guard is good, but I think a better approach is don't let the idle timer fire at all while connecting. I’d prefer guard in enableIdleTimer() and we only call enableIdldTimer() when the connection is connected, and there are 2 places, rather than the existing approach during the active client construction. Once the upstream connection is connected, the upstream client will be moved to the ready_clients_ to accept streams, so the idle timeout will be cleared / disabled at that time.

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 was thinking about that but took this approach as it is a low risk fix. I wasn't sure of changing idle timeout logic (moving away from constructor). Any way, changed as per your comments. PTAL.

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
@ramaraochavali
Copy link
Contributor Author

/retest

@kyessenov
Copy link
Contributor

@botengyao This needs your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Envoy closing upstream connection as idle even before connection established when idle_timeout is less than connect timeout

6 participants