Title: stream/iter: pipeToSync() ignores writeSync() backpressure and overcounts bytes · Issue #63562 · nodejs/node · GitHub
Open Graph Title: stream/iter: pipeToSync() ignores writeSync() backpressure and overcounts bytes · Issue #63562 · nodejs/node
X Title: stream/iter: pipeToSync() ignores writeSync() backpressure and overcounts bytes · Issue #63562 · nodejs/node
Description: Version 26.2.0 Platform macOS 26.5.0 Subsystem stream What steps will reproduce the bug? import { setTimeout as delay } from 'node:timers/promises'; import { pipeToSync, push } from 'node:stream/iter'; const decoder = new TextDecoder(); ...
Open Graph Description: Version 26.2.0 Platform macOS 26.5.0 Subsystem stream What steps will reproduce the bug? import { setTimeout as delay } from 'node:timers/promises'; import { pipeToSync, push } from 'node:stream/it...
X Description: Version 26.2.0 Platform macOS 26.5.0 Subsystem stream What steps will reproduce the bug? import { setTimeout as delay } from 'node:timers/promises'; import { pipeToSync, push } from 'no...
Opengraph URL: https://github.com/nodejs/node/issues/63562
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"stream/iter: pipeToSync() ignores writeSync() backpressure and overcounts bytes","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 { setTimeout as delay } from 'node:timers/promises';\nimport { pipeToSync, push } from 'node:stream/iter';\n\nconst decoder = new TextDecoder();\nconst { writer, readable } = push({ highWaterMark: 1 });\n\nconst total = pipeToSync(['a', 'b'], writer, { preventClose: true });\n\nconst iter = readable[Symbol.asyncIterator]();\nconst first = await iter.next();\n\nconst second = await Promise.race([\n iter.next().then((r) =\u003e r.done ? '\u003cdone\u003e' : decoder.decode(r.value[0])),\n delay(20, '\u003cno second chunk\u003e'),\n]);\n\nawait iter.return?.();\n\nconsole.log(`pipeToSync returned: ${total}`);\nconsole.log(`first buffered chunk: ${decoder.decode(first.value[0])}`);\nconsole.log(`second buffered chunk: ${second}`);\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\npipeToSync returned: 1\nfirst buffered chunk: a\nsecond buffered chunk: \u003cno second chunk\u003e\n```\n\n`pipeToSync()` should throw or otherwise signal that the second sync write was not accepted. It should not count bytes for a chunk when `writeSync()` or `writevSync()` returns false without accepting the data.\n\n### What do you see instead?\n\n```console\npipeToSync returned: 2\nfirst buffered chunk: a\nsecond buffered chunk: \u003cno second chunk\u003e\n```\n\n`pipeToSync()` reports that 2 bytes were written even though the strict `push({ highWaterMark: 1 })` writer only accepted `a`. The failed `writeSync('b')` return value is ignored, so data is silently dropped and byte accounting is incorrect.\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/trivikr","@type":"Person","name":"trivikr"},"datePublished":"2026-05-25T16:27:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/63562/node/issues/63562"}
| 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:56dfccff-f83b-42bd-9361-31da801715b1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D0BA:B577:7D2AFC:AAA5A1:6A4DB393 |
| html-safe-nonce | 48439b5129fdfff53ac304d8f6141bd359abacd95b2c52aea573d031823622e0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMEJBOkI1Nzc6N0QyQUZDOkFBQTVBMTo2QTREQjM5MyIsInZpc2l0b3JfaWQiOiI4MTM4MDg5MjYzODUxNzQ2MTk1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a66659bb961d78dabd11f269305ce75d1937594557a8cd2a5af8f5b5845fc06f |
| hovercard-subject-tag | issue:4518273113 |
| 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/63562/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1ed45f482813cb71310c7df7e413b95f39156b661206cc9234f1c60331354fe3/nodejs/node/issues/63562 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1ed45f482813cb71310c7df7e413b95f39156b661206cc9234f1c60331354fe3/nodejs/node/issues/63562 |
| og:image:alt | Version 26.2.0 Platform macOS 26.5.0 Subsystem stream What steps will reproduce the bug? import { setTimeout as delay } from 'node:timers/promises'; import { pipeToSync, push } from 'node:stream/it... |
| 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 | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| 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 | 32f7b614aca06e6bbd89842b1370df1328264f68 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width