Ensure hibernated websockets handle code updates gracefully - #6948
Open
jqmmes wants to merge 2 commits into
Open
Ensure hibernated websockets handle code updates gracefully#6948jqmmes wants to merge 2 commits into
jqmmes wants to merge 2 commits into
Conversation
This commit adds the necessary methods to ensure hibernated websockets can survive code updates
jqmmes
force-pushed
the
joaquim/hibernated-ws-survive-code-updates
branch
from
August 10, 2026 15:34
e4d85d2 to
2818290
Compare
Contributor
|
LGTM |
| : typeId(typeId), | ||
| params(kj::mv(params)), | ||
| manager(manager) {} | ||
| manager(manager.addRef()) {} |
Contributor
There was a problem hiding this comment.
IIUC because of this strong ref:
- The hibernation manager owns readLoopTasks.
- A read-loop task dispatches a custom event and waits for it to settle.
- The custom event strongly owns the hibernation manager.
- The manager cannot be destroyed because the event owns it.
- The task cannot be cancelled by the manager’s destructor because destruction cannot begin.
If the outer RPC or dispatch never settles, the cycle can remain indefinitely I think?
Contributor
Author
There was a problem hiding this comment.
Yeah, that correct. I'll change the strong ref
|
|
||
| namespace { | ||
| // Maps each hibernatable WebSocket event ID currently being delivered to the manager that owns the | ||
| // socket. The registry is process-global because delivery can cross event loops, but the manager, |
Contributor
There was a problem hiding this comment.
Does it need to be process-global, considering use of the manager requires it to be on the original thread? So there's mutexes + cleanups but can the same not be achieved with thread-local stores?
As I don't think there's a capability in the case of a thread mismatch to run on the original thread, so this could be simplified quite a bit I think if that's the case?
Contributor
Author
There was a problem hiding this comment.
Yeah, it can be simplified.
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.
This PR adds the necessary methods to ensure hibernated websockets can survive code updates while hibernated.