Skip to content

Conversation

@swankjesse
Copy link
Collaborator

Previously we didn't do any health checks at all until a
connection completed a single exchange. This was awkward
for HTTP/2, which could have multiple exchanges in-flight
before any were health checked.

We were also doing the awkward and expensive read timeout
check on all non-GET requests on pooled connections. Now
we only perform these checks if the connection was idle
for 10 seconds or more.

Closes: #5547

companion object {
private const val NPE_THROW_WITH_NULL = "throw with null exception"
private const val MAX_TUNNEL_ATTEMPTS = 21
private const val IDLE_CONNECTION_HEALTHY_NS = 1_000_000_000 // 10 seconds.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this one second?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Endless screaming.

It is. I wanted to use const which took away TimeUnit.toNanos().

"Too many tunnel connections attempted: $MAX_TUNNEL_ATTEMPTS"))
}

idleAtNs = System.nanoTime()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Assume this triggers the behaviour change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep.

@swankjesse swankjesse force-pushed the jwilson.0217.change_healthy_check branch from d5967d4 to d8aa784 Compare February 17, 2020 20:38
Previously we didn't do any health checks at all until a
connection completed a single exchange. This was awkward
for HTTP/2, which could have multiple exchanges in-flight
before any were health checked.

We were also doing the awkward and expensive read timeout
check on all non-GET requests on pooled connections. Now
we only perform these checks if the connection was idle
for 10 seconds or more.

Closes: #5547
@swankjesse swankjesse force-pushed the jwilson.0217.change_healthy_check branch from d8aa784 to 19cb19a Compare February 17, 2020 21:00
assertThat(server.takeRequest().getSequenceNumber()).isEqualTo(0);
}

@Test public void staleConnectionNotReusedForNonIdempotentRequest() throws Exception {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved this test to Kotlin so that I could manipulate idleAtNs.

@swankjesse swankjesse merged commit 3f946d0 into master Feb 17, 2020
@oldergod oldergod deleted the jwilson.0217.change_healthy_check branch March 7, 2020 22:05
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.

Race condition causes retry loop?

3 participants