René's URL Explorer Experiment


Title: http2: closing and then destroying a client stream whose body is still queued sends no RST_STREAM and loops on empty DATA frames until OOM · Issue #67363 · nodejs/node · GitHub

Open Graph Title: http2: closing and then destroying a client stream whose body is still queued sends no RST_STREAM and loops on empty DATA frames until OOM · Issue #67363 · nodejs/node

X Title: http2: closing and then destroying a client stream whose body is still queued sends no RST_STREAM and loops on empty DATA frames until OOM · Issue #67363 · nodejs/node

Description: Version v22.23.4 Platform Linux x64 Subsystem http2 What steps will reproduce the bug? Save as repro.js and run node repro.js (no dependencies). The client runs in a forked child, and the parent kills it at 1 GiB. 'use strict' const http...

Open Graph Description: Version v22.23.4 Platform Linux x64 Subsystem http2 What steps will reproduce the bug? Save as repro.js and run node repro.js (no dependencies). The client runs in a forked child, and the parent ki...

X Description: Version v22.23.4 Platform Linux x64 Subsystem http2 What steps will reproduce the bug? Save as repro.js and run node repro.js (no dependencies). The client runs in a forked child, and the parent ki...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"http2: closing and then destroying a client stream whose body is still queued sends no RST_STREAM and loops on empty DATA frames until OOM","articleBody":"### Version\n\nv22.23.4 \n\n### Platform\n\n```text\nLinux x64\n```\n\n### Subsystem\n\nhttp2\n\n### What steps will reproduce the bug?\n\nSave as `repro.js` and run `node repro.js` (no dependencies). The client runs in a forked child, and the parent kills it at 1 GiB.\n\n```js\n'use strict'\nconst http2 = require('node:http2')\nconst fs = require('node:fs')\nconst { fork, execFileSync } = require('node:child_process')\n\n// The client runs in a forked child: once the bug triggers, its event loop never runs\n// again, so the parent watches the child's RSS and kills it at 1 GiB.\nif (process.argv[2] === 'child') {\n  const session = http2.connect(`http://127.0.0.1:${process.argv[3]}`)\n  const req = session.request({ ':method': 'POST', ':path': '/' })\n  req.on('error', () => {})\n  req.end(Buffer.alloc(2 * 1024 * 1024))\n  // Close (NO_ERROR) and destroy while most of the body is still queued behind flow control.\n  setTimeout(() => { req.close(); req.destroy() }, 100)\n  setInterval(() => {}, 1000)\n  return\n}\n\n// Parent: a server that doesn't read the 2 MiB body for 1s, so the upload stalls at the\n// 64 KiB stream window and the abort lands while most of the body is queued.\nfunction rssMiB (pid) {\n  try {\n    const m = /VmRSS:\\s+(\\d+)/.exec(fs.readFileSync(`/proc/${pid}/status`, 'utf8'))\n    if (m) return Number(m[1]) / 1024\n  } catch {}\n  return Number(execFileSync('ps', ['-o', 'rss=', '-p', String(pid)]).toString().trim()) / 1024\n}\nconst server = http2.createServer()\nserver.on('session', (s) => s.on('error', () => {}))\nserver.on('stream', (stream) => {\n  stream.on('error', () => {})\n  stream.on('close', () => console.log(`server: stream closed, rstCode=${stream.rstCode}`))\n  setTimeout(() => stream.resume(), 1000)\n})\nserver.listen(0, '127.0.0.1', () => {\n  const child = fork(__filename, ['child', String(server.address().port)])\n  let peak = 0\n  const done = (code, msg) => { clearInterval(t); child.kill('SIGKILL'); server.close(); console.log(msg); process.exit(code) }\n  const t = setInterval(() => {\n    peak = Math.max(peak, rssMiB(child.pid))\n    if (peak > 1024) done(1, `RUNAWAY: client RSS passed ${Math.round(peak)} MiB after one aborted upload`)\n  }, 100)\n  setTimeout(() => done(0, `ok: client RSS peaked at ${Math.round(peak)} MiB`), 5000)\n})\n```\n\n\n### How often does it reproduce? Is there a required condition?\n\nEvery time. The required condition: when the client closes and destroys the stream, part of the request body must still be queued behind flow control, because the server hasn't read it yet. A body that fits in the window, or a server that reads promptly, doesn't trigger it.\n\n### What is the expected behavior? Why is that the expected behavior?\n\n`close()` followed by `destroy()` should leave the stream reset on the wire (RST_STREAM), and the session should go on working with flat memory. Destroying a stream shouldn't leave nghttp2 holding a stream that Node no longer knows about.\n\n### What do you see instead?\n\n```\nRUNAWAY: client RSS passed 1104 MiB after one aborted upload\n```\n\nNo RST_STREAM is sent. Once the server reads the body and sends WINDOW_UPDATE, the client's main thread spins in native code and RSS grows at about 0.5–1 GiB/s until the process is killed. In production OOM reports, the faulting frame is `node::http2::Http2Session::CopyDataIntoOutgoing`.\n\n### Additional information\n\nThe sequence as we understand it:\n\n1. `req.close()` (NO_ERROR) while the writable side is still ending: `closeStream` in `lib/internal/http2/core.js` defers submitting the RST_STREAM until `'finish'`. That never fires, because the body can't flush without window.\n2. `req.destroy()`: `_destroy` doesn't submit an RST because the stream is already closed, and `Http2Stream::Destroy` removes the stream from the session. nghttp2 still has the stream open with its data provider.\n3. On WINDOW_UPDATE, nghttp2 calls `Http2Session::OnRead` (`src/node_http2.cc`). The stream lookup fails and it returns 0 without `NGHTTP2_DATA_FLAG_EOF`. nghttp2 sends a 0-length DATA frame and calls OnRead again. Those frames consume no window, so the `nghttp2_session_mem_send` / `CopyDataIntoOutgoing` loop in `SendPendingData` never ends.\n\nPossible fixes. We haven't built Node to test either one:\n\n- In `_destroy`, submit the RST if `close()` deferred it to `'finish'` and it hasn't gone out yet.\n- As a backstop, have `OnRead` return `NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE` when the stream is gone, so nghttp2 resets it instead of looping.\n\nThe same thing can be reached without calling `close()` directly. undici's HTTP/2 client calls `close()` and then `destroy()` when a request is aborted (UNDICI_ISSUE_LINK). That's how we hit it in production, and nodejs/undici#6181 looks like the same crash.\n\nRelated: #66306 (an `'aborted'` listener destroyed the stream before the RST was submitted). Its fix, #66314, only reorders the `'aborted'` event and doesn't cover this sequence. #66742 (canceled upload leaves session memory over budget) is a separate issue.\n\n_This report was prepared with an AI coding assistant and reviewed by me._","author":{"url":"https://github.com/elyndefigma","@type":"Person","name":"elyndefigma"},"datePublished":"2026-11-09T20:12:05Z","url":"https://github.com/nodejs/node/issues/67363"}

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:7928d719-f8a0-fad5-ceab-e497669011b0
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB37E:138048:B14214:E5318C:6B063961
html-safe-nonceb471829f3f4055bab77ea579eeeabc5a8c6b5473d1f76e2907d37e1d9817bb1b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzdFOjEzODA0ODpCMTQyMTQ6RTUzMThDOjZCMDYzOTYxIiwidmlzaXRvcl9pZCI6IjQwNjM3OTk3MTg2Nzk4MjE3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacc1b8a611f3da8dc388ef8c2fef53ad13804f7eaa007bcb28c02643bd7a1719c6
hovercard-subject-tagissue:6293851700
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/67363/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ca3659a599f0ff93677f3e3b9554bfdba8c184dcee5255a8dbc3a94326a69099/nodejs/node/issues/67363
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ca3659a599f0ff93677f3e3b9554bfdba8c184dcee5255a8dbc3a94326a69099/nodejs/node/issues/67363
og:image:altVersion v22.23.4 Platform Linux x64 Subsystem http2 What steps will reproduce the bug? Save as repro.js and run node repro.js (no dependencies). The client runs in a forked child, and the parent ki...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameelyndefigma
hostnamegithub.com
expected-hostnamegithub.com
Nonedcf72c457c022486d23c3cbb0dd21aba537a87611ca9ddabd1799cf2eaa9b297
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
release0f38f5735226749ec5e08a8649dce4cb2613d9ad
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/67363#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F67363
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%2F67363
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/67363
Reloadhttps://github.com/nodejs/node/issues/67363
Reloadhttps://github.com/nodejs/node/issues/67363
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues629 (629)https://github.com/nodejs/node/issues
Pull requests658 (658)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/67363
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/67363
#67372https://github.com/nodejs/node/pull/67372
http2: closing and then destroying a client stream whose body is still queued sends no RST_STREAM and loops on empty DATA frames until OOMhttps://github.com/nodejs/node/issues/67363#top
#67372https://github.com/nodejs/node/pull/67372
confirmed-bughttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22confirmed-bug%22
http2https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http2%22
https://github.com/elyndefigma
elyndefigmahttps://github.com/elyndefigma
on Nov 9, 2026https://github.com/nodejs/node/issues/67363#issue-6293851700
nodejs/undici#6181https://github.com/nodejs/undici/issues/6181
#66306https://github.com/nodejs/node/issues/66306
#66314https://github.com/nodejs/node/pull/66314
#66742https://github.com/nodejs/node/issues/66742
inoway46https://github.com/inoway46
on Nov 10, 2026https://github.com/nodejs/node/issues/67363#event-35650401461
http2: send deferred RST_STREAM on stream destroyhttps://github.com/inoway46/node/commit/7288a165dc7cd7e1e72dcedf73a3b65d4a47a311
7288a16https://github.com/inoway46/node/commit/7288a165dc7cd7e1e72dcedf73a3b65d4a47a311
https://github.com/inoway46
inoway46https://github.com/inoway46
on Nov 10, 2026https://github.com/nodejs/node/issues/67363#issuecomment-6760611304
#64623https://github.com/nodejs/node/pull/64623
#67372https://github.com/nodejs/node/pull/67372
inoway46https://github.com/inoway46
confirmed-bughttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22confirmed-bug%22
http2https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http2%22
on Nov 10, 2026https://github.com/nodejs/node/issues/67363#event-35651038386
nodejs-github-bothttps://github.com/nodejs-github-bot
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#67372https://github.com/nodejs/node/pull/67372
on Nov 14, 2026https://github.com/nodejs/node/issues/67363#event-36102201428
noritaka1166https://github.com/noritaka1166
on Nov 14, 2026https://github.com/nodejs/node/issues/67363#event-36103157643
http2: send deferred RST_STREAM on stream destroyhttps://github.com/noritaka1166/node/commit/f8ab6107a45c9f0a7a859ab36dbf2ab00cd61122
f8ab610https://github.com/noritaka1166/node/commit/f8ab6107a45c9f0a7a859ab36dbf2ab00cd61122
gabedemesahttps://github.com/gabedemesa
on Nov 16, 2026https://github.com/nodejs/node/issues/67363#event-36304695174
http2: send deferred RST_STREAM on stream destroyhttps://github.com/gabedemesa/node/commit/4bd7f6960687d2cfd6f0d147456ae5762b088a28
4bd7f69https://github.com/gabedemesa/node/commit/4bd7f6960687d2cfd6f0d147456ae5762b088a28
http2: send deferred RST_STREAM on stream destroyhttps://github.com/gabedemesa/node/commit/09203e13c4f6104815fa79093e7908cc50ce0048
09203e1https://github.com/gabedemesa/node/commit/09203e13c4f6104815fa79093e7908cc50ce0048
http2: send deferred RST_STREAM on stream destroyhttps://github.com/gabedemesa/node/commit/8c09fc3ca5cf1a631eedd633a01aa6f16478d107
8c09fc3https://github.com/gabedemesa/node/commit/8c09fc3ca5cf1a631eedd633a01aa6f16478d107
aduh95https://github.com/aduh95
on Nov 19, 2026https://github.com/nodejs/node/issues/67363#event-36667031625
http2: send deferred RST_STREAM on stream destroyhttps://github.com/nodejs/node/commit/bb6d44da728f62b5c7d17d3515706151e7ad28af
bb6d44dhttps://github.com/nodejs/node/commit/bb6d44da728f62b5c7d17d3515706151e7ad28af
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/67363
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/67363
confirmed-bughttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22confirmed-bug%22
http2https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http2%22
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.