stream: fix ERR_INVALID_STATE when cancelling Readable.toWeb() - #62773
stream: fix ERR_INVALID_STATE when cancelling Readable.toWeb()#62773richardscarrott wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62773 +/- ##
==========================================
+ Coverage 90.12% 90.17% +0.05%
==========================================
Files 752 771 +19
Lines 252325 264910 +12585
Branches 47456 50310 +2854
==========================================
+ Hits 227407 238894 +11487
- Misses 16217 16981 +764
- Partials 8701 9035 +334
🚀 New features to boost your workflow:
|
|
Thank you for your contribution @richardscarrott! Could you please fix the linting errors? |
|
Howdy folks! I think we're running into this as well — @richardscarrott if you don't have time to take this over the finish line, happy to take it over and fix the linting errors! |
|
@smoores-dev @efekrskl soz, forgot about this. I have some time tomorrow to fix this up. |
96e546b to
93b1db6
Compare
|
Rebased onto main and fixed the lint error. Worth flagging for re-review: #62394 rewrote Note this is the @meixg your approval predates the rebase, so this likely needs another look. |
This comment was marked as resolved.
This comment was marked as resolved.
When a web ReadableStream returned by Readable.toWeb() is cancelled while the underlying Readable is actively producing data, a pending onData callback can still fire after the controller has been closed and attempt to enqueue a chunk, throwing ERR_INVALID_STATE. Check wasCanceled in the onData handler and return early to avoid calling controller.enqueue() on a closed controller. Refs: nodejs#54205 Signed-off-by: Richard Scarrott <riscarrott@googlemail.com>
93b1db6 to
c0fe52d
Compare
|
Added the missing Could a collaborator start a fresh CI run and re-add the |
Thanks for fixing the trailer!
@panva is re-running the GitHub Actions CI. I have put back the
author ready
It's going to need another Jenkins CI triggered, however there is currently some work being done to fix a flaky test, so I'll let @panva continue looking after your PR. |
When a web ReadableStream returned by Readable.toWeb() is cancelled while the underlying Readable is actively producing data, a pending onData callback can still fire after the controller has been closed and attempt to enqueue a chunk, throwing ERR_INVALID_STATE.
Check wasCanceled in the onData handler and return early to avoid calling controller.enqueue() on a closed controller.
Refs: #54205