Follow-up to max-connection-age: infinite grace test, docs, and FOREVER round-trip in Java setters - #1323
Merged
Conversation
…ace with a later terminate Motivation: Review of apache#1316 noted that reference.conf only documents one direction of the interaction between max-connection-age and a server binding termination, that the combination of max-connection-age-grace = infinite with a later terminate was not tested, and that some new tests had tight timing margins. Modification: - reference.conf: state that a later terminate with an earlier deadline shortens a drain started by the age, also with an infinite grace period, mirroring http2.md. - Http2ServerSpec: add a test for max-connection-age-grace = infinite followed by terminate(10.millis). - Http2ServerSpec: widen timing margins (age 1s vs expectNoBytes(700ms), terminate(2s) vs expectNoBytes(700ms)). Result: The documented and tested behaviour covers both directions, and the timing sensitive tests have more headroom on loaded CI machines. Tests: - sbt "http2-tests/testOnly ...Http2ServerSpec -- -z max-connection-age": 7 tests pass - scalafmt on the changed spec References: Refs apache#1316
…n setters Motivation: Getters such as ConnectionPoolSettings.getKeepAliveTimeout return ChronoUnit.FOREVER.getDuration for an infinite value, but the matching Java setters converted with toScala, which throws IllegalArgumentException for that value. Passing a getter's result back to its setter failed on the default settings of keep-alive-timeout, max-connection-lifetime and periodic-keep-alive-max-idle. Modification: Use JavaDurationConverter.toScala, the inverse of the toJava used by the getters, in the Java setters of ClientConnectionSettings.idleTimeout, ConnectionPoolSettings idleTimeout, keepAliveTimeout, maxConnectionLifetime and responseEntitySubscriptionTimeout, and WebSocketSettings.periodicKeepAliveMaxIdle. Result: Infinite durations round-trip through the Java API. Tests: - sbt "http-core/testOnly org.apache.pekko.http.scaladsl.settings.*": 27 pass; the 3 new round-trip tests fail without the fix - sbt "http-core/mimaReportBinaryIssues": clean References: Refs apache#1316
pjfanning
requested review from
He-Pin,
Philippus,
nvollmar,
raboof and
samueleresca
October 2, 2026 10:08
nvollmar
approved these changes
Oct 3, 2026
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.
Motivation
Addresses the points in #1316 (comment), including the suggested follow-up for the other Java setters that have the same
FOREVERround-trip problem aswithMaxConnectionAge.Modification
reference.conf: themax-connection-agecomment now also states the converse case, that a laterterminatewith an earlier deadline shortens a drain started by the age (also whenmax-connection-age-graceisinfinite). This mirrorshttp2.md.Http2ServerSpec: new test formax-connection-age-grace = infinitefollowed by a laterterminate(10.millis).Http2ServerSpec: wider timing margins. The age test now uses a 1s age withexpectNoBytes(700.millis)(was 500ms / 400ms). The "not shorten" test now usesterminate(2.seconds)(was 1s).ChronoUnit.FOREVER.getDurationfor an infinite value now convert withJavaDurationConverter.toScala. Previously they usedtoScala, which throwsIllegalArgumentExceptionon that value. The affected setters are:ClientConnectionSettings.withIdleTimeoutConnectionPoolSettings.withIdleTimeout,withKeepAliveTimeout,withMaxConnectionLifetime,withResponseEntitySubscriptionTimeoutWebSocketSettings.withPeriodicKeepAliveMaxIdleResult
withKeepAliveTimeout(getKeepAliveTimeout)threw on the default settings.Tests
sbt "http2-tests/testOnly org.apache.pekko.http.impl.engine.http2.Http2ServerSpec -- -z max-connection-age": 7 tests passsbt "http-core/testOnly org.apache.pekko.http.scaladsl.settings.*": 27 tests pass. The 3 new round-trip tests fail without the fix (IllegalArgumentException: Java duration PT2562047788015215H30M7.999999999S cannot be expressed as a Scala duration)sbt "http-core/mimaReportBinaryIssues": cleanscalafmtrun on the changed Scala filesReferences
Refs #1316
🤖 Generated with Claude Code