fix(deno): Handle reader.closed rejection from releaseLock() in streaming#20187
fix(deno): Handle reader.closed rejection from releaseLock() in streaming#20187andreiborza wants to merge 2 commits intodevelopfrom
reader.closed rejection from releaseLock() in streaming#20187Conversation
…treaming Replace `reader.closed.finally(() => onDone())` with `reader.closed.then(() => onDone(), () => onDone())` in `monitorStream`. Per the WHATWG Streams spec, `reader.releaseLock()` rejects `reader.closed` when the promise is still pending. `.finally()` propagates that rejection as an unhandled promise rejection, while `.then(f, f)` suppresses it by handling both the fulfilled and rejected cases. Closes: #20177
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Core
Bug Fixes 🐛
🤖 This preview updates automatically when you update the PR. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f21ef57. Configure here.
size-limit report 📦
|
s1gr1d
left a comment
There was a problem hiding this comment.
Seems like a good approach - looks good 👍

This PR replaces
reader.closed.finally(() => onDone())withreader.closed.then(() => onDone(), () => onDone())inmonitorStream.Per the WHATWG Streams spec,
reader.releaseLock()rejectsreader.closedwhen the promise is still pending..finally()propagates that rejection as an unhandled promise rejection, while.then(f, f)suppresses it by handling both the fulfilled and rejected cases.I was not able to reproduce the error directly on my deno version but this should prevent the issue.
Closes: #20177