Repository navigation
Conversation
927b283 to
beec719
Compare
pjfanning
left a comment
There was a problem hiding this comment.
The engine change looks right to me: the GOAWAY goes through the control-frame queue after any request HEADERS, in-flight streams still drain, and nothing changes with the option off. Two points on the code:
The setting is stored by wrapping internalSettings. GracefulGoAwayEnabled(delegate) wraps the slot, sendGoAwayOnGracefulClose is true when the slot holds the wrapper, and withInternalSettings re-wraps to keep the flag. This is the same concern as on #981, #1556, #1589 and now #1664, each of which uses the slot in a different way:
settings.internalSettingsno longer returns what was passed towithInternalSettingsonce the flag is on, so any reader has to know to unwrap it.copy(internalSettings = Some(x))on the impl silently drops the flag.- It does not compose with the other PRs: each would overwrite, or fail to recognise, the others' value in the slot.
I would rather this were a real field on Http2ClientSettingsImpl, and that we settle one approach for all of these PRs.
withoutClientGoAway has no test. It is the only thing that stops managedPersistentHttp2* from sending the GOAWAY when the wrapper completes its inner request source on retirement or downstream cancellation, and removing the two withoutClientGoAway. prefixes would leave every test green. Could you add a case with the option on and a managed connection, asserting that no GOAWAY is sent on cancel or retire?
Smaller: a request source that fails rather than completes is described as not sending a GOAWAY, and by my reading that is what happens (onUpstreamFailure -> failStage), but there is no user.requestOut.sendError(...) case to pin it.
Motivation: Allow direct HTTP/2 clients to announce that they have stopped sending requests before closing an otherwise healthy connection. Modification: Queue a single GOAWAY(NO_ERROR) on a normal request-source completion when the option is enabled. Keep the existing response drain and do not change managed cancellation or application-failure behavior. Store the opt-in in an independent immutable settings field; preserve released constructor, factory and copy descriptors. Result: Existing applications keep the default and error behavior. A caller can opt into graceful close without replacing the internal settings, and an older settings copy preserves the active opt-in. Tests: JDK 17 on Scala 2.13.18 and 3.3.9: ten focused settings, direct and managed lifecycle cases per axis, an actual Java settings caller, released 2.0.0 Scala linkage probes and zero scoped MiMa findings. Scoped Scala formatting and whitespace checks passed. References: RFC 9113 Section 6.8. Addresses PJ's review on apache#1665; related apache#1556.
beec719 to
228676a
Compare
pjfanning
left a comment
There was a problem hiding this comment.
pushGOAWAY in Http2Demux is also rewritten by #1664, which routes every GOAWAY through sendFinalGoAway -> freezeAdmissionBoundary() -> lastStreamId(). Whichever lands second has to keep goAwayLastStreamId(), otherwise a post-graceful error GOAWAY advertises the client's own last request id instead of 0 (the "not raise the GOAWAY boundary if keepalive later times out" test would catch it).
Java: the new javadsl Http2ClientSettings.withSendGoAwayOnGracefulClose cannot be applied to a connection from Java, because javadsl ClientConnectionSettings has no withHttp2Settings/mapHttp2Settings (the docs fall back to a config string for Java). That gap is pre-existing, but it means the new setter is effectively config-only for Java users.
Motivation
Let a direct HTTP/2 client notify the peer when the application has finished sending requests, without changing defaults or the existing response drain.
Modification
pekko.http.client.http2.send-goaway-on-graceful-close. Queue oneGOAWAY(NO_ERROR)on normal request-source completion and preserve outstanding responses and their completion deadline.Result
Opted-in direct connections close gracefully without losing accepted responses, and applications without the opt-in keep their existing behavior.
Tests
References