question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BlazeClient's idleTimeout works differently than BlazeServer's idleTimeout

See original GitHub issue

Both BlazeClient and BlazeServer offer an idleTimeout configuration option. The option has the same name in both, and shares implementation (IdleTimeoutStage) but from user’s perspective it behaves differently.

In BlazeClient the idleTimeout is active only when a request is in-flight. It may kick in if the server takes too long to respond (unless other timeout does it first) or when the server starts sending a response and then pauses for too long. An idle (not borrowed from the pool) connection will remain open indefinitly as the idleTimeout is deactivated when a connection is returned to the pool. This may contradict users assumptions about the meaning of the word “idle” in the context of an HTTP client.

In BlazeServer the idleTimeout is always active, and it may terminate connections that have an in-flight request but nothing happened for too long, as well as connections which are kept open but unused.

I see this inconsistency as a bad developer experience. In addition to that I see the lack of mechanism for evicting unused connections from the client’s connection pool, as a missing feature and potential resource leak.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
RafalSumislawskicommented, Jul 10, 2021

I’m not convinced what we should do with the blaze-server idleTimeout (or if we should do anything with it).

What I am currently convinced to is that the changes in akka-http-client go in the right direction and we should do the same in blaze-client. It should have two timeouts:

  • an idleTimeout that is active while the connection is being used. It’s main purpose being to prevent getting stuck in this state. The current implementation does exactly that.
  • and a new keepAliveTimeout which would be active while the connection sits in the pool.

While this doesn’t solve the user experience problem I stated in the title of this issue “BlazeClient’s idleTimeout works differently than BlazeServer’s idleTimeout”. I think it solves the the more serious technical problems of:

  • being unable to evict connections from the pool before server closes them, and therefore risking a race between client using the connection and server closing it due to timeout.
  • being able to evict unused connection from the pool in order to free up resources

P.S. I feel a need to on more client-side timeout, sort of a maximumLifespan, that would be useful in forcing a rebalancing of connections though a load-balancer. But that’s a story for another ticket.

1reaction
RafalSumislawskicommented, May 4, 2021

http4s/http4s#3700 seems to be related. Maybe the can be solved together.

Read more comments on GitHub >

github_iconTop Results From Across the Web

BlazeClient's idleTimeout works differently than BlazeServer's ...
Both BlazeClient and BlazeServer offer an idleTimeout configuration option. The option has the same name in both, and shares implementation ...
Read more >
Understanding Idle Timeout and Keep Alive Interval settings in ...
Idle Timeout and Keep Alive Interval are two idle connection management settings in the TCP profile, which allow an administrator to specify ...
Read more >
Configure the idle connection timeout for your Classic Load ...
Use the following procedure to set a different value for the idle timeout. To configure the idle timeout setting for your load balancer....
Read more >
Hikari CP maxLifetime / idleTimeout - Stack Overflow
The Hikari housekeeper runs every 30s, which closes any connections that are not in use and are older than maxLifetime .
Read more >
Idle timeout - IBM
The idletimeout parameter specifies the period of time, in milliseconds, that a connection is allowed to remain idle.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found