Skip to content

Add option to quarantine on ping timeout - #11

Draft
jeffreymeng wants to merge 1 commit into
richard/lossy-subrequestfrom
jeffrey/h2-ping-quarantine
Draft

jeffreymeng wants to merge 1 commit into
richard/lossy-subrequestfrom
jeffrey/h2-ping-quarantine

Conversation

@jeffreymeng

Copy link
Copy Markdown

No description provided.

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());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

do we need to consider other connections here?

Comment on lines 459 to 463
fn handle_err(&self, mut e: Box<Error>) -> Box<Error> {
if self.ping_timedout() {
e.etype = PING_TIMEDOUT;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

does this classify all errors as ping_timedout

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:?}"),
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

potentially do we end up in a state here where we don't ever close this connection?

  1. The last request finishes before quarantine. release_http_session() puts the connection into the idle pool.
  2. A subsequent PING times out.
  3. we reach this part of the code
  4. 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.
  5. The idle-pool watcher listens for connection closure, eviction, checkout, or the idle timeout. It does not listen for shutting_down becoming true

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.

2 participants