STOR-5552: Serialize WebSocket writes across hibernation - #7147
Open
apeacock1991 wants to merge 2 commits into
Open
STOR-5552: Serialize WebSocket writes across hibernation#7147apeacock1991 wants to merge 2 commits into
apeacock1991 wants to merge 2 commits into
Conversation
Contributor
|
I'm Bonk, and I've done a quick review of your PR. PR #7147 serializes hibernatable WebSocket writes across revival.
|
A WebSocket pump can remain blocked after its API WebSocket hibernates. A revived adapter can then start a second send on the same native socket, which trips KJ's single-send assertion. Transfer a settlement-only pump signal through the hibernation package. Use it to order revived sends and auto-responses without retaining the old pump or its IoContext. Cancel deferred write continuations before destroying the native socket. Add coverage for repeated hibernation, active auto-responses after revival, and manager teardown with a deferred response.
apeacock1991
force-pushed
the
apeacock/stor-5552-pump-settlement-barrier
branch
from
August 27, 2026 14:52
b8ec734 to
ebfab60
Compare
Only hibernatable WebSockets transfer pump completion across adapter replacement. Avoid creating completion promises for every regular WebSocket pump. Centralize write-barrier branching and remove stale test documentation.
harrishancock
approved these changes
Aug 27, 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.
Summary
A hibernatable WebSocket can replace its API adapter while the old adapter's output pump is still blocked in
kj::WebSocket::send().Writes from the revived adapter then race the old send and hit thesingle-send assertion.
Carry a settlement-only signal from the old pump through the hibernation package. The hibernation manager uses it to order revived sends, closes, and auto-responses without retaining the old pump or its
IoContext.The barrier does not preserve a message canceled during
IoContextdestruction. It only prevents a replacement adapter from writing before
the old pump has settled.