Repository navigation
fix(triple): ping idle HTTP/2 connections on the server - #3910
Open
AsperforMias wants to merge 2 commits into
Open
AsperforMias wants to merge 2 commits into
AsperforMias wants to merge 2 commits into
Conversation
The Triple server set no HTTP/2 keepalive, so a consumer that went away without closing its connection (suspended, network partition, host failure) left the provider's handlers running until the operating system gave up on the TCP connection. The server now uses TripleConfig.KeepAliveInterval and KeepAliveTimeout, which already configure the client, for http.Server.HTTP2: a connection that receives nothing for the interval is pinged and closed when the ping goes unanswered within the timeout, which cancels its handlers. The defaults are the client's, 10s and 20s, and an interval of 0 disables the pings. The setting covers cleartext and TLS HTTP/2. Invalid values are rejected when the service is exported.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3910 +/- ##
============================================
+ Coverage 46.76% 61.12% +14.35%
============================================
Files 295 515 +220
Lines 17172 42447 +25275
============================================
+ Hits 8031 25945 +17914
- Misses 8287 14693 +6406
- Partials 854 1809 +955 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
AlexStocks
reviewed
Nov 29, 2026
KeepAliveInterval and KeepAliveTimeout configure both sides, and the client passes them to its HTTP/2 transport as they are. The server rejected a zero timeout and negative values that the client accepts, so a process exporting a provider with the same configuration failed to register it. The server now rejects only values that do not parse and hands the rest to net/http with the same meaning as on the client: an interval of 0 or less disables the pings, a timeout of 0 or less uses the default of 15s.
|
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Fixes #3900
Part of #3898
The Triple server configured no HTTP/2 keepalive. A consumer that went away without closing its connection (process suspended, network partition, host failure) left the provider's handlers running until the operating system gave up on the TCP connection. The consumer side already pings idle connections (10 s / 20 s by default), so it noticed a vanished provider within 30 s; the provider never noticed a vanished consumer.
Changes
TripleConfig.KeepAliveIntervalandKeepAliveTimeout, the fields that already configure the consumer, and sets them onhttp.Server.HTTP2: a connection that receives nothing for the interval is pinged, and it is closed when the ping goes unanswered within the timeout, which cancels its handlers.http.Server.HTTP2is read by net/http's HTTP/2 server for TLS connections and by the cleartext h2c handler, so both are covered, including the HTTP/2 side ofhttp2-and-http3.TripleConfigno longer say "for client".Verification
TestServerClosesSilentHTTP2Connection: a peer answers the server's SETTINGS and first PING, is pinged again, then stops answering and is disconnected; over cleartext HTTP/2, over TLS, and on the TLS side ofhttp2-and-http3. Each case fails without the setting on its start path.TestServerHTTP2Config,TestResolveServerTransportRejectsInvalidKeepAliveandTestKeepAliveConfigSharedByConsumerAndProvider: defaults, configured values, zero and negative values accepted by both sides, and unparsable values rejected at export.SIGSTOP: with the provider built fromdevelop, both handlers were still running 45 s later, when the consumer was killed; with this branch both handler contexts were canceled 29.4 s after the suspension.Checklist
developmake fmtto format my codemake testto run local tests