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

http2: fix graceful session close #30854

Closed

Commits on Dec 16, 2019

  1. Copy the full SHA
    0995c29 View commit details
    Browse the repository at this point in the history
  2. http2: wait for session socket writable end on close/destroy

    This slightly alters the behaviour of session close by first using
    .end() on a session socket to finish writing the data and only then
    calls .destroy() to make sure the Readable side is closed. This allows
    the socket to finish transmitting data, receive proper FIN packet and
    avoid ECONNRESET errors upon graceful close.
    
    onStreamClose now directly calls stream.destroy() instead of
    kMaybeDestroy because the latter will first check that the stream has
    writableFinished set. And that may not be true as we have just
    (synchronously) called .end() on the stream if it was not closed and
    that doesn't give it enough time to finish. Furthermore there is no
    point in waiting for 'finish' as the other party have already closed the
    stream and we won't be able to write anyway.
    
    This also changes a few tests to correctly handle graceful session
    close. This includes:
    * not reading request data (on client side)
    * not reading push stream data (on client side)
    * relying on socket.destroy() (on client) to finish server session
      due to the destroy of the socket without closing the server session.
      As the goaway itself is *not* a session close.
    
    Added few 'close' event mustCall checks.
    lundibundi committed Dec 16, 2019
    Copy the full SHA
    082c0cb View commit details
    Browse the repository at this point in the history