-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
Version
vertx-core:4.5.15
Context
We are using a Vert.x client under heavy load, and we noticed that some connections are never released after the traffic finishes even with a Http2KeepAliveTimeout configured.
We found that these connections had their lastStreamId set to 0. So, I believe the problem is that these connections never had a valid stream. As a result, the Http2ClientConnection.recycle() method is never called, and the expirationTimestamp field is not updated, so the connection is never released due to the keepAliveTimeout.
I have fixed it by adding in the constructor:
Http2ClientConnection(
HttpClientBase client,
ContextInternal context,
VertxHttp2ConnectionHandler connHandler,
ClientMetrics metrics) {
super(context, connHandler);
this.metrics = metrics;
this.client = client;
// We set the keep-alive timeout from the beginning
int timeout = client.options().getHttp2KeepAliveTimeout();
this.expirationTimestamp = timeout > 0 ? System.currentTimeMillis() + timeout * 1000L : 0L;
}
What do you think about this? Could this change have a side effect, or is it fine as it is?
Thx!
Reactions are currently unavailable