Skip to content

Conversation

@tsegismont
Copy link
Member

Closes #5360

It would help in some cases:

  • make sure a connection does not live longer than authorized by some firewall
  • give an opportunity to the client to find new backend replicas started after the pool reached its maximum size

@tsegismont tsegismont requested a review from vietj March 20, 2025 14:27
@tsegismont
Copy link
Member Author

@vietj I would like to rebase this PR but can you tell me if you have any concern with it before?

Closes eclipse-vertx#5360

It would help in some cases:

- make sure a connection does not live longer than authorized by some firewall
- give an opportunity to the client to find new backend replicas started after the pool reached its maximum size

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
@vietj vietj added this to the 5.0.0 milestone Apr 29, 2025
@vietj vietj merged commit 0d46bb1 into eclipse-vertx:master May 6, 2025
8 checks passed
@NilsRenaud
Copy link
Contributor

Sorry I've missed to subscribe to this issue, so I'm a bit late on this one...

But I see an issue with the fix: when the maxLifetime threshold is reached the connection gets closed instead of shutdowned with a grace period.
Closing the connection is brutal and will break the requests/responses happening on it without any notice. It would have been cleaner to have an eviction period, waiting for requests to complete during X sec but not accepting new one in the meantime to reduce the risk of killing healthy HTTP traffic.

closing the connection was the right move when dealing with KeepAliveTimeout but not when dealing with the lifetime of a connection.

What do you think ?

@vietj
Copy link
Member

vietj commented May 14, 2025

@NilsRenaud sounds like a good idea

@NilsRenaud
Copy link
Contributor

Thanks @vietj , what should we do next then ? re-open the issue ? Create another one as "improvement" ?

@vietj
Copy link
Member

vietj commented May 14, 2025

open an issue with a precise description

@tsegismont
Copy link
Member Author

tsegismont commented May 14, 2025

@NilsRenaud I'm not sure what you mean, HttpConnectionInternal::isValid is the predicate provided to io.vertx.core.internal.pool.ConnectionPool#evict(java.util.function.Predicate<C>).

The doc for this method reads:

Evict connections from the pool with a {@code predicate}, only unused connection can be evicted.

@NilsRenaud
Copy link
Contributor

Good point ! I missed it, thanks for your answer @tsegismont

@tsegismont tsegismont deleted the issue/5360 branch June 13, 2025 12:30
@NilsRenaud
Copy link
Contributor

That being said, if a request on this connection hangs forever, the connection will never be closed, right ?

@tsegismont
Copy link
Member Author

Yeah, if connections are constantly busy, the max lifetime might not be honored

@NilsRenaud
Copy link
Contributor

I'm wondering whether this could be a problem 🤔
Could this potentially infinite connection lifetime be abused ?

@tsegismont tsegismont removed the request for review from vietj July 17, 2025 11:12
@tsegismont
Copy link
Member Author

tsegismont commented Jul 17, 2025

I guess it could, but I'd rather not fabricate a use case. If somebody reports an actual problem, we'll look into it.

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.

Support max lifetime on HTTP Client pool

3 participants