René's URL Explorer Experiment


Title: http2: async iteration reports premature close with buffered responses in v26.3.0+ and v24.20.0 · Issue #65677 · nodejs/node · GitHub

Open Graph Title: http2: async iteration reports premature close with buffered responses in v26.3.0+ and v24.20.0 · Issue #65677 · nodejs/node

X Title: http2: async iteration reports premature close with buffered responses in v26.3.0+ and v24.20.0 · Issue #65677 · nodejs/node

Description: Version v26.8.1 and v24.20.0 (official binaries). The regression starts between v26.2.0 and v26.3.0; v24.18.0 also passes. See the comparison below. Platform macOS, Darwin 25.6.0, arm64. Subsystem http2, stream (eos() and Readable async ...

Open Graph Description: Version v26.8.1 and v24.20.0 (official binaries). The regression starts between v26.2.0 and v26.3.0; v24.18.0 also passes. See the comparison below. Platform macOS, Darwin 25.6.0, arm64. Subsystem ...

X Description: Version v26.8.1 and v24.20.0 (official binaries). The regression starts between v26.2.0 and v26.3.0; v24.18.0 also passes. See the comparison below. Platform macOS, Darwin 25.6.0, arm64. Subsystem ...

Opengraph URL: https://github.com/nodejs/node/issues/65677

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"http2: async iteration reports premature close with buffered responses in v26.3.0+ and v24.20.0","articleBody":"### Version\n\nv26.8.1 and v24.20.0 (official binaries). The regression starts between v26.2.0 and v26.3.0; v24.18.0 also passes. See the comparison below.\n\n### Platform\n\nmacOS, Darwin 25.6.0, arm64.\n\n### Subsystem\n\n`http2`, `stream` (`eos()` and Readable async iteration)\n\n### What steps will reproduce the bug?\n\nSave this as `repro-http2-premature-close.mjs` and run it with `node repro-http2-premature-close.mjs`. It uses only Node built-in modules, localhost, and an ephemeral port. No proxy or third-party dependency is needed.\n\n```js\n// Run with an unmodified Node binary: node repro-http2-premature-close.mjs\n// Uses only built-in modules, localhost, and an ephemeral port.\nimport assert from 'node:assert/strict';\nimport { once } from 'node:events';\nimport http2 from 'node:http2';\nimport { setImmediate } from 'node:timers/promises';\n\nconst server = http2.createServer();\nserver.on('stream', (stream) => {\n  stream.resume();\n  stream.on('end', () => {\n    stream.respond({ ':status': 200 }, { waitForTrailers: true });\n    stream.on('wantTrailers', () => stream.sendTrailers({ 'grpc-status': '0' }));\n    stream.end('complete response');\n  });\n});\nserver.listen(0, '127.0.0.1');\nawait once(server, 'listening');\nconst session = http2.connect(`http://127.0.0.1:${server.address().port}`);\n\ntry {\n  await once(session, 'connect');\n  const request = session.request({ ':method': 'POST' });\n  const response = once(request, 'response');\n  request.end('request');\n  await response;\n\n  // Delay consuming the response until HTTP/2 reports a normal stream close.\n  // The complete response body is still buffered, and the stream is not destroyed.\n  const deadline = Date.now() + 2_000;\n  while (!request.closed && Date.now() \u003c deadline) await setImmediate();\n  assert.equal(request.closed, true);\n  assert.equal(request.rstCode, 0);\n  assert.equal(request.destroyed, false);\n  assert.equal(request.readableLength, Buffer.byteLength('complete response'));\n\n  let body = '';\n  for await (const chunk of request) body += chunk.toString();\n  assert.equal(body, 'complete response');\n  console.log(`${process.version}: PASS`);\n} finally {\n  session.destroy();\n  await once(session, 'close');\n  server.close();\n  await once(server, 'close');\n}\n```\n\n### How often does it reproduce? Is there a required condition?\n\nThe equivalent direct-connection test failed on all 20 attempts in each affected version listed below. The required condition is that iteration starts after the HTTP/2 stream closes normally, while the response body is still buffered.\n\nBefore reading, the reproduction asserts `closed === true`, `rstCode === 0`, `destroyed === false`, and that all 17 response bytes remain in `readableLength`. It does not destroy the stream before consuming it; session destruction is only in cleanup.\n\nWithout intentionally waiting for this state, the failure depends on scheduling. Downstream gRPC calls through proxy/Duplex transports exposed it, but the reproduction removes both the proxy and the gRPC library.\n\n### What is the expected behavior? Why is that the expected behavior?\n\n`for await` consumes `complete response` successfully and finishes without an error. The process exits with status 0, as it does on v24.18.0 and v26.2.0. The HTTP/2 stream closed normally and its complete response is still readable.\n\n### What do you see instead?\n\n`for await` throws `ERR_STREAM_PREMATURE_CLOSE`; the process exits with status 1. On v26.8.1:\n\n```text\nError [ERR_STREAM_PREMATURE_CLOSE]: Premature close\n    at getEosOnCloseError (node:internal/streams/end-of-stream:98:14)\n    at eos (node:internal/streams/end-of-stream:159:23)\n    at start (node:internal/streams/readable:1425:15)\n    at Object.next (node:internal/streams/readable:1574:23)\n```\n\nv24.20.0 fails with the same error through `getEosOnCloseError` / `eos` / `createAsyncIterator`.\n\n### Additional information\n\n**Version comparison** for the equivalent direct-connection reproduction, delaying consumption until `request.closed`:\n\n| Node version | Successful responses / attempts |\n| --- | --- |\n| 24.18.0 | 20 / 20 |\n| 24.20.0 | 0 / 20 |\n| 26.2.0 | 20 / 20 |\n| 26.3.0 | 0 / 20 |\n| 26.7.0 | 0 / 20 |\n| 26.8.1 | 0 / 20 |\n\nThe single-case script above was also verified separately with v24.18.0 and v26.2.0 (exit 0), and with v24.20.0, v26.3.0 and v26.8.1 (exit 1).\n\n**Suspected regression mechanism:** the version boundary and source comparison point to #62394, [cbee0de1cb](https://github.com/nodejs/node/commit/cbee0de1cb0cc2947d024bc1228c965ae115a55f), released in [v26.3.0](https://nodejs.org/en/blog/release/v26.3.0). The same change was backported as [5658c631fa](https://github.com/nodejs/node/commit/5658c631fa) in [v24.20.0](https://nodejs.org/en/blog/release/v24.20.0).\n\n`Http2Stream.closed` can be true after a normal protocol close while the readable body is still buffered. `eos()` now computes `immediateResult` before that buffer is consumed, then reports the captured premature-close error in a subsequent `process.nextTick()` callback. The previous implementation evaluated the close error on the next tick instead.\n\nA diagnostic comparison on v26.8.1, keeping its async iterator unchanged and only recomputing the close result inside the next-tick callback, changes the direct-connection test from 0/20 to 20/20 successful responses. That is evidence for the timing regression, not a proposed production monkey patch.\n\n**Related reports checked:** #63989 and #64098 concern HTTP/1.1 keep-alive / `node-fetch`. This reproduction uses core HTTP/2 with a normal protocol close, and also fails on v26.8.1 after those reports were resolved. #44866 is the older Web Stream termination hang addressed by #62394, rather than this new async-iteration failure.\n","author":{"url":"https://github.com/colinaaa","@type":"Person","name":"colinaaa"},"datePublished":"2026-08-31T11:14:30Z","url":"https://github.com/nodejs/node/issues/65677"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:34b10bc5-28f5-356a-5e7d-faf387c54387
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA15E:254F12:AD1062:DB1F0F:6B036A01
html-safe-nonced2124c9163e62ebf45568bd413a53dfb5c280040ce5ceb09f202b6e89d972886
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTVFOjI1NEYxMjpBRDEwNjI6REIxRjBGOjZCMDM2QTAxIiwidmlzaXRvcl9pZCI6Ijg3MzkxMTM3MzI5OTY4MTk0NTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac4661e6c0cf9596c828e3213b95b36a00a43cbb849619928b77ea5cb32b9d8b97
hovercard-subject-tagissue:5299494957
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/65677/issue_layout
twitter:imagehttps://opengraph.githubassets.com/16676c0cb3e4de911056048b0950459318e338dc083337e6a2204367e4fe85af/nodejs/node/issues/65677
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/16676c0cb3e4de911056048b0950459318e338dc083337e6a2204367e4fe85af/nodejs/node/issues/65677
og:image:altVersion v26.8.1 and v24.20.0 (official binaries). The regression starts between v26.2.0 and v26.3.0; v24.18.0 also passes. See the comparison below. Platform macOS, Darwin 25.6.0, arm64. Subsystem ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamecolinaaa
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/65677#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F65677
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F65677
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/65677
Reloadhttps://github.com/nodejs/node/issues/65677
Reloadhttps://github.com/nodejs/node/issues/65677
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues639 (639)https://github.com/nodejs/node/issues
Pull requests667 (667)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/insights
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65677
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65677
#67553https://github.com/nodejs/node/pull/67553
http2: async iteration reports premature close with buffered responses in v26.3.0+ and v24.20.0https://github.com/nodejs/node/issues/65677#top
#67553https://github.com/nodejs/node/pull/67553
https://github.com/colinaaa
colinaaahttps://github.com/colinaaa
on Aug 31, 2026https://github.com/nodejs/node/issues/65677#issue-5299494957
#62394https://github.com/nodejs/node/pull/62394
cbee0de1cbhttps://github.com/nodejs/node/commit/cbee0de1cb0cc2947d024bc1228c965ae115a55f
v26.3.0https://nodejs.org/en/blog/release/v26.3.0
5658c631fahttps://github.com/nodejs/node/commit/5658c631fa
v24.20.0https://nodejs.org/en/blog/release/v24.20.0
#63989https://github.com/nodejs/node/issues/63989
#64098https://github.com/nodejs/node/issues/64098
#44866https://github.com/nodejs/node/issues/44866
#62394https://github.com/nodejs/node/pull/62394
https://github.com/bitpshr
bitpshrhttps://github.com/bitpshr
on Aug 31, 2026https://github.com/nodejs/node/issues/65677#issuecomment-5484371150
#65689https://github.com/nodejs/node/pull/65689
https://github.com/rwieruch
rwieruchhttps://github.com/rwieruch
on Sep 3, 2026https://github.com/nodejs/node/issues/65677#issuecomment-5528632661
stream: recompute the close error when eos() defers #65689https://github.com/nodejs/node/pull/65689
#65689https://github.com/nodejs/node/pull/65689
nodejs-github-bothttps://github.com/nodejs-github-bot
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#67553https://github.com/nodejs/node/pull/67553
on Nov 19, 2026https://github.com/nodejs/node/issues/65677#event-36681259935
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/65677
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65677
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.