-
Notifications
You must be signed in to change notification settings - Fork 667
Support a handler for checking connection status using Ping frame in HTTP/2 #3612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 1.2.x
Are you sure you want to change the base?
Conversation
171dfc5
to
202d036
Compare
18196bd
to
231b27d
Compare
reactor-netty-http/src/main/java/reactor/netty/http/Http2SettingsSpec.java
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/Http2SettingsSpec.java
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/Http2SettingsSpec.java
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/Http2SettingsSpec.java
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/client/Http2ConnectionLivenessHandler.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/client/Http2ConnectionLivenessHandler.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/client/Http2ConnectionLivenessHandler.java
Outdated
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClientConfig.java
Outdated
Show resolved
Hide resolved
...y-http/src/test/java/reactor/netty/resources/PooledConnectionProviderDefaultMetricsTest.java
Show resolved
Hide resolved
reactor-netty-http/src/test/java/reactor/netty/http/client/HttpClientTest.java
Outdated
Show resolved
Hide resolved
@raccoonback Can you rebase against branch |
231b27d
to
a06c842
Compare
@violetagg |
a06c842
to
8c4cdbc
Compare
@raccoonback I'll review this PR later this week |
@raccoonback Nice idea! I think that we can reuse our current I think this feature is interesting for both server and client, similar to TCP keep-alive that we support for both of them. |
@violetagg
Looking forward to your feedback! 😊 |
Yes
Yes
Yes
We may need to move I think that this feature is interesting for both client and server. Wdyt? |
Thank you for the detailed explanation! |
@violetagg |
@raccoonback I plan to review this PR next week. |
Signed-off-by: raccoonback <kosb15@naver.com>
… in HTTP/2 Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
…e ping interval - ref. https://github.com/reactor/reactor-netty/actions/runs/13095356929/job/36537031690?pr=3612 Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
- Added a method to configure the execution interval of the scheduler that sends HTTP/2 PING frames and periodically checks for ACK responses - Introduced a retry threshold setting to limit the number of PING transmission attempts before considering the connection as unresponsive - Default values: - Scheduler interval must be explicitly set - Retry threshold defaults to 0 (no retries, only one PING attempt) Signed-off-by: raccoonback <kosb15@naver.com>
- Added support for HTTP/2 PING-based health checks in IdleTimeoutHandler - Ensures connections remain active during health checks Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
@@ -680,6 +680,50 @@ include::{examples-dir}/channeloptions/Application.java[lines=18..54] | |||
<4> Configures the time between individual `keepalive` probes to 1 minute. | |||
<5> Configures the maximum number of TCP `keepalive` probes to 8. | |||
|
|||
|
|||
==== IdleTimeout | |||
The maximum time (resolution: ms) that this connection stays opened and waits for HTTP request. Once the timeout is reached, the connection is closed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The maximum time (resolution: ms) that this connection stays opened and waits for HTTP request
Can you please elaborate more on this?
This is HttpClient so it initiates the HTTP request. (May be you mean the connection stays idle in the connection pool?) As part of the connection pool we already have a configuration for dropping the idle connections so this new configuration seems to be not needed? (check Http2Pool)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@violetagg
This describes configuring IdleTimeout
on the HttpClient side using IdleTimeoutHandler
, independently of the connection pool settings.
From my understanding, since the connection pool already manages idle connections, applying an additional IdleTimeoutHandler
at the HttpClient
level may be redundant.
Could you please confirm if this understanding is accurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I think it is redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@violetagg
Understood!
Then, I will exclude the IdleTimeoutHandler on the client side.
Signed-off-by: raccoonback <kosb15@naver.com>
… from pipeline Signed-off-by: raccoonback <kosb15@naver.com>
Signed-off-by: raccoonback <kosb15@naver.com>
Description
In some cases, HTTP/2 connections may remain open even when they are no longer functional. By introducing a periodic Ping frame health check, we can proactively detect and close unhealthy connections.
The Http2ConnectionLivenessHandler schedules and sends Ping frames at a user-defined interval to verify the connection's liveness. If an acknowledgment (ACK) is not received within the specified time, the connection is considered unhealthy and is closed automatically.
However, if other frames are actively being sent or received, the scheduler does not send a Ping frame. This is because the server may delay ACK responses for various reasons. To prevent unnecessary connection termination, Ping frames are only sent when no read or write activity is detected.
Additionally, a configurable retry threshold for Ping frame transmission has been introduced. If a Ping frame fails to receive an ACK response, it will be retried up to the specified threshold before considering the connection unhealthy. This allows fine-tuning of the failure detection mechanism, balancing between aggressive failure detection and avoiding premature disconnections.
Scheduler Flow
Ping ACK Flow
Key Changes
Http2ConnectionLivenessHandler
handler to check connection health with Ping frames at a configurable interval.Http2SettingsSpec
.Related Issue