Skip to content

fix(H2 Client): bind stream 'data' listener only after received 'response' event#2985

Merged
ronag merged 6 commits intonodejs:mainfrom
st3ffgv4:main
Mar 25, 2024
Merged

fix(H2 Client): bind stream 'data' listener only after received 'response' event#2985
ronag merged 6 commits intonodejs:mainfrom
st3ffgv4:main

Conversation

@st3ffgv4
Copy link
Copy Markdown
Contributor

@st3ffgv4 st3ffgv4 commented Mar 22, 2024

This relates to...

#2808

Rationale

Sporadically when doing massive h2 requests for a certain period of time a breaking assertion is triggered "assert(!this.aborted)" in onHeaders Method [undici/lib/core/request.js] causing application crash

Changes

  • lib/dispatcher/client-h2.js

Features

N/A

Bug Fixes

  • Sometimes happens that H2 Stream "data" event is triggered some milliseconds before the "response" event, this leads to an uninitialized body. To avoid this breaking error if the onData is called before onHeaders, return false so the stream is paused in client-h2.js

Breaking Changes and Deprecations

Status

  • I have read and agreed to the [Developer's Certificate of Origin][cert]
  • Tested
  • Benchmarked (optional)
  • Documented
  • Review ready
  • In review
  • Merge ready

[cert]: https://github.com/nodejs/undici/blob/main/CONTRIBUTING.md #

Loading
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.

6 participants