Title: stream/iter: pending next() hangs after iterator return() · Issue #63519 · nodejs/node · GitHub
Open Graph Title: stream/iter: pending next() hangs after iterator return() · Issue #63519 · nodejs/node
X Title: stream/iter: pending next() hangs after iterator return() · Issue #63519 · nodejs/node
Description: Version 26.2.0 Platform macOS 26.5.0 Subsystem stream What steps will reproduce the bug? import { broadcast, push } from 'node:stream/iter'; async function check(name, pendingNext) { const result = await Promise.race([ pendingNext.then( ...
Open Graph Description: Version 26.2.0 Platform macOS 26.5.0 Subsystem stream What steps will reproduce the bug? import { broadcast, push } from 'node:stream/iter'; async function check(name, pendingNext) { const result =...
X Description: Version 26.2.0 Platform macOS 26.5.0 Subsystem stream What steps will reproduce the bug? import { broadcast, push } from 'node:stream/iter'; async function check(name, pendingNext) { const ...
Opengraph URL: https://github.com/nodejs/node/issues/63519
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"stream/iter: pending next() hangs after iterator return()","articleBody":"### Version\n\n26.2.0\n\n### Platform\n\n```text\nmacOS 26.5.0\n```\n\n### Subsystem\n\nstream\n\n### What steps will reproduce the bug?\n\n```js\nimport { broadcast, push } from 'node:stream/iter';\n\nasync function check(name, pendingNext) {\n const result = await Promise.race([\n pendingNext.then(\n (value) =\u003e ({ status: 'settled', value }),\n (error) =\u003e ({ status: 'rejected', error }),\n ),\n new Promise((resolve) =\u003e {\n setTimeout(() =\u003e resolve({ status: 'timeout' }), 100);\n }),\n ]);\n\n if (result.status === 'timeout') {\n console.log(`${name}: observed hang; expected pending next() to settle after return()`);\n } else {\n console.log(`${name}: settled`, result);\n }\n}\n\n{\n const { readable } = push();\n const iter = readable[Symbol.asyncIterator]();\n\n const pendingNext = iter.next();\n await iter.return();\n\n await check('push()', pendingNext);\n}\n\n{\n const { broadcast: bc } = broadcast();\n const iter = bc.push()[Symbol.asyncIterator]();\n\n const pendingNext = iter.next();\n await iter.return();\n\n await check('broadcast()', pendingNext);\n}\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways\n\n### What is the expected behavior? Why is that the expected behavior?\n\n```console\npush(): settled {\n status: 'settled',\n value: [Object: null prototype] { value: undefined, done: true }\n}\nbroadcast(): settled {\n status: 'settled',\n value: [Object: null prototype] { done: true, value: undefined }\n}\n```\n\n`pendingNext` should settle after await `iter.return()`, normally as `{ value: undefined, done: true }` or a rejection, so no read promise is left unresolved.\n\n### What do you see instead?\n\n```console\npush(): observed hang; expected pending next() to settle after return()\nbroadcast(): observed hang; expected pending next() to settle after return()\n```\n\n`pendingNext` stays pending and the timeout wins, because `next()` stores a resolver for the empty read, but `return()` detaches/cleans up without resolving or rejecting that stored pending read.\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/trivikr","@type":"Person","name":"trivikr"},"datePublished":"2026-05-23T16:27:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/63519/node/issues/63519"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6c4e7857-5031-97a1-f968-510f10274750 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EE12:C61B2:2853531:39FE075:6A4D2256 |
| html-safe-nonce | 5c684e5358f70bb17bb56f8d26ad79f14abca640113102dfa0d5cc0c10796eb2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRTEyOkM2MUIyOjI4NTM1MzE6MzlGRTA3NTo2QTREMjI1NiIsInZpc2l0b3JfaWQiOiI4MDg0OTc3NDk2NDA1OTEwMTAyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | fe445b8a9f2dd7a48d3252033b429938b49b5bb686d5db6946f67ecf4d62c65b |
| hovercard-subject-tag | issue:4508888339 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/63519/issue_layout |
| twitter:image | https://opengraph.githubassets.com/986136b1e467473284e29bb4e0c7eb888191cde491fe4858248b449ea72beac5/nodejs/node/issues/63519 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/986136b1e467473284e29bb4e0c7eb888191cde491fe4858248b449ea72beac5/nodejs/node/issues/63519 |
| og:image:alt | Version 26.2.0 Platform macOS 26.5.0 Subsystem stream What steps will reproduce the bug? import { broadcast, push } from 'node:stream/iter'; async function check(name, pendingNext) { const result =... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trivikr |
| hostname | github.com |
| expected-hostname | github.com |
| None | 92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 93f17a978ee60bc4668e1d7b90e6bd2d622261fd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width