Skip to content

Conversation

@hyperair
Copy link

@hyperair hyperair commented Jan 6, 2026

This PR fixes an issue where http2 requests taking longer than 500ms will be terminated prematurely, with http2.request silently resolving with truncated responses instead of rejecting with an error.

The issue comes from starting the idle shutdown timer (500ms) immediately after the beginning of the latest request on the session, and not detecting that the session is still actively transferring data before forcefully terminating the session.

This PR fixes that by switching the connection idle shutdown timer to session.setTimeout instead of setTimeout.

I've also verified that this fix makes the client in https://github.com/hyperair/google-http2-bug-demo work correctly (more info here):

  • all requests return the correct untruncated data
  • client process shuts down properly after all requests are done

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #768 🦕

Use `session.setTimeout` instead of `setTimeout` for the idle shutdown timer.

Fixes: googleapis#768
FakeClient now needs a setTimeout function
@hyperair hyperair requested a review from a team as a code owner January 6, 2026 10:41
@google-cla
Copy link

google-cla bot commented Jan 6, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP/2 session is closed while file beeing uploaded

1 participant