Title: stream/iter: Broadcast and Share leak consumers for invalid or pre-aborted signals · Issue #65298 · nodejs/node · GitHub
Open Graph Title: stream/iter: Broadcast and Share leak consumers for invalid or pre-aborted signals · Issue #65298 · nodejs/node
X Title: stream/iter: Broadcast and Share leak consumers for invalid or pre-aborted signals · Issue #65298 · nodejs/node
Description: Version main Platform N/A Subsystem stream What steps will reproduce the bug? import { broadcast, share, from } from 'node:stream/iter'; const cases = [ ['Broadcast', () => { const { broadcast: bc } = broadcast(); return [bc, (options) =...
Open Graph Description: Version main Platform N/A Subsystem stream What steps will reproduce the bug? import { broadcast, share, from } from 'node:stream/iter'; const cases = [ ['Broadcast', () => { const { broadcast: bc ...
X Description: Version main Platform N/A Subsystem stream What steps will reproduce the bug? import { broadcast, share, from } from 'node:stream/iter'; const cases = [ ['Broadcast', () => { con...
Opengraph URL: https://github.com/nodejs/node/issues/65298
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"stream/iter: Broadcast and Share leak consumers for invalid or pre-aborted signals","articleBody":"### Version\n\nmain\n\n### Platform\n\n```text\nN/A\n```\n\n### Subsystem\n\nstream\n\n### What steps will reproduce the bug?\n\n```js\nimport { broadcast, share, from } from 'node:stream/iter';\n\nconst cases = [\n ['Broadcast', () => {\n const { broadcast: bc } = broadcast();\n return [bc, (options) => bc.push(options)];\n }],\n ['Share', () => {\n const shared = share(from('x'));\n return [shared, (options) => shared.pull(options)];\n }],\n];\n\nfor (const [name, make] of cases) {\n let [owner, consume] = make();\n\n try {\n consume({ signal: {} });\n } catch (error) {\n console.log(name, 'invalid signal:', error.code,\n 'consumerCount:', owner.consumerCount);\n }\n\n [owner, consume] = make();\n\n const controller = new AbortController();\n controller.abort(new Error('already aborted'));\n\n const iterator =\n consume({ signal: controller.signal })[Symbol.asyncIterator]();\n\n try {\n await iterator.next();\n } catch (error) {\n console.log(name, 'pre-aborted signal:', error.message,\n 'consumerCount:', owner.consumerCount);\n }\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\nSignal validation or pre-abort handling should not register a consumer - or should immediately detach it - so `consumerCount` remains `0`.\n\nAs per [§13.1.3, Broadcast.push()](https://iter-streams.proposal.wintertc.org/#broadcast-push) and [§13.2.3, Share.pull()](https://iter-streams.proposal.wintertc.org/#share-pull)\n> On break/error, abort pipelineController and detach the cursor.\n\n### What do you see instead?\n\n```console\nBroadcast invalid signal: ERR_INVALID_ARG_TYPE consumerCount: 1\nBroadcast pre-aborted signal: already aborted consumerCount: 1\nShare invalid signal: ERR_INVALID_ARG_TYPE consumerCount: 1\nShare pre-aborted signal: already aborted consumerCount: 1\n```\n\nPassing an invalid or already-aborted signal throws or rejects, but leaves an inaccessible consumer registered with `consumerCount === 1`, potentially causing permanent backpressure.\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/trivikr","@type":"Person","name":"trivikr"},"datePublished":"2026-08-15T04:45:55Z","url":"https://github.com/nodejs/node/issues/65298"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| 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:b067b54f-5a3b-5067-22de-dcaf55420fee |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C898:A3A4:3A5A8F:536ADB:6AED372F |
| html-safe-nonce | 9c5fe35d38e817640eb1221a9cfa51da26943ca8b2ed85f8018fbff7cf3caee9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODk4OkEzQTQ6M0E1QThGOjUzNkFEQjo2QUVEMzcyRiIsInZpc2l0b3JfaWQiOiI3MjIzNTgxNzQ2MDQzNjMxNDA3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 895ec0f9618e5d306542a6fd1b0a160a91d1ffdfb2c07d49d6825f2cdf8e5d88 |
| hovercard-subject-tag | issue:5157698174 |
| 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/65298/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9ed3cf3d8e0fbcf231ff6deef2bb64e125fdabfe22ca44589276425971b18718/nodejs/node/issues/65298 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9ed3cf3d8e0fbcf231ff6deef2bb64e125fdabfe22ca44589276425971b18718/nodejs/node/issues/65298 |
| og:image:alt | Version main Platform N/A Subsystem stream What steps will reproduce the bug? import { broadcast, share, from } from 'node:stream/iter'; const cases = [ ['Broadcast', () => { const { broadcast: bc ... |
| 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 | 26c92a9388ddfad3fa88d132b5d5f0b4747030233dcc4e5efb05f1cbae152184 |
| 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 | c629ad99c254d306375fc8354d04321c2c362236 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width