Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move owned WebSocket back to api::WebSocket on final hibernation event #664

Merged
merged 2 commits into from
May 18, 2023

Commits on May 18, 2023

  1. Move owned ws back to js after receiving a close

    We saw a situation where queued websocket messages (send()/close()) that
    were inserted during the webSocketClose event failed to deliver. This
    was caused by the fact that the HibernationManager drops
    HibernatableWebSocket's after their final close/error event is
    dispatched.
    
    Unfortunately, the HibernatableWebSocket would get dropped too soon, so
    the underlying kj::WebSocket was no longer available to send messages.
    
    We fix this by moving the owned kj::Own<kj::WebSocket> out from the
    HibernatableWebSocket and back into the api::WebSocket's NativeState
    after dispatching the final close/error event. NativeState's lifetime
    is managed by the IoContext's DeleteQueue, so it lives long enough to
    flush the remaining messages.
    MellowYarker committed May 18, 2023
    Configuration menu
    Copy the full SHA
    b81c9ca View commit details
    Browse the repository at this point in the history
  2. Additional websocket cleanup

    Related to the hibernation work; we noticed a few other things that
    could potentially lead to problems.
    MellowYarker committed May 18, 2023
    Configuration menu
    Copy the full SHA
    6a32783 View commit details
    Browse the repository at this point in the history