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

Fix JS Stream Socket finishShutdown crash #49400

Closed

Commits on Aug 29, 2023

  1. net: fix crash due to simultaneous close/shutdown on JS Stream Sockets

    A JS stream socket wraps a stream, exposing it as a socket for something
    on top which needs a socket specifically (e.g. an HTTP server).
    
    If the internal stream is closed in the same tick as the layer on top
    attempts to close this stream, the race between doShutdown and doClose
    results in an uncatchable exception. A similar race can happen with
    doClose and doWrite.
    
    It seems legitimate these can happen in parallel, so this resolves that
    by explicitly detecting and handling that situation: if a close is in
    progress, both doShutdown & doWrite allow doClose to run
    finishShutdown/Write for them, cancelling the operation, without trying
    to use this._handle (which will be null) in the meantime.
    pimterry committed Aug 29, 2023
    Configuration menu
    Copy the full SHA
    2050b6f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fb9611b View commit details
    Browse the repository at this point in the history