Add option to quarantine on ping timeout - #11
Draft
jeffreymeng wants to merge 1 commit into
Draft
jeffreymeng wants to merge 1 commit into
jeffreymeng wants to merge 1 commit into
Conversation
molocule
reviewed
Sep 24, 2026
Comment on lines
+417
to
+421
| // and it's possible we get an in use connection that is closed and not yet released. | ||
| // Also filter out connections quarantined by a ping timeout | ||
| .filter(|c| !c.is_closed() && !c.is_shutting_down()) | ||
| .or_else(|| self.idle_pool.get(&reuse_hash)) | ||
| .filter(|c| !c.is_shutting_down()); |
There was a problem hiding this comment.
do we need to consider other connections here?
molocule
reviewed
Sep 24, 2026
Comment on lines
459
to
463
| fn handle_err(&self, mut e: Box<Error>) -> Box<Error> { | ||
| if self.ping_timedout() { | ||
| e.etype = PING_TIMEDOUT; | ||
| } | ||
|
|
There was a problem hiding this comment.
does this classify all errors as ping_timedout
molocule
reviewed
Sep 24, 2026
Comment on lines
+571
to
+581
| r = rx => match (r, quarantine_flag) { | ||
| // Quarantine rather than close | ||
| (Ok(_), Some(shutting_down)) => { | ||
| ping_timeout_occurred.store(true, Ordering::Relaxed); | ||
| shutting_down.store(true, Ordering::Relaxed); | ||
| warn!("H2 connection Ping timeout/Error fd: {id}, connection will be quarantined"); | ||
| match c.await { | ||
| Ok(_) => debug!("H2 connection finished fd: {id}"), | ||
| Err(e) => debug!("H2 connection fd: {id} errored: {e:?}"), | ||
| } | ||
| } |
There was a problem hiding this comment.
potentially do we end up in a state here where we don't ever close this connection?
- The last request finishes before quarantine. release_http_session() puts the connection into the idle pool.
- A subsequent PING times out.
- we reach this part of the code
- But the idle pool still holds a ConnectionRef, which owns an H2 SendRequest handle. H2 therefore sees that someone can still use the connection and does not automatically close it.
- The idle-pool watcher listens for connection closure, eviction, checkout, or the idle timeout. It does not listen for shutting_down becoming true
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.