René's URL Explorer Experiment


Title: http2: assertion failure `onread->IsFunction()` when a session is destroyed from a 'stream' handler · Issue #64850 · nodejs/node · GitHub

Open Graph Title: http2: assertion failure `onread->IsFunction()` when a session is destroyed from a 'stream' handler · Issue #64850 · nodejs/node

X Title: http2: assertion failure `onread->IsFunction()` when a session is destroyed from a 'stream' handler · Issue #64850 · nodejs/node

Description: What steps will reproduce the bug? node:http2 aborts on an internal assertion when an HTTP/2 session is destroyed from inside a 'stream' handler while the peer's DATA frames are still in the receive buffer: node[...]: v8::MaybeLocal

Open Graph Description: What steps will reproduce the bug? node:http2 aborts on an internal assertion when an HTTP/2 session is destroyed from inside a 'stream' handler while the peer's DATA frames are still in the receiv...

X Description: What steps will reproduce the bug? node:http2 aborts on an internal assertion when an HTTP/2 session is destroyed from inside a 'stream' handler while the peer's DATA frames are still i...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"http2: assertion failure `onread->IsFunction()` when a session is destroyed from a 'stream' handler","articleBody":"## What steps will reproduce the bug?\n\n`node:http2` aborts on an internal assertion when an HTTP/2 session is destroyed from inside a `'stream'` handler while the peer's DATA frames are still in the receive buffer:\n\n```\nnode[...]: v8::MaybeLocal\u003cv8::Value> node::StreamBase::CallJSOnreadMethod(ssize_t, v8::Local\u003cv8::ArrayBuffer>, std::size_t, StreamBaseJSChecks) at ../src/stream_base.cc:473\nAssertion failed: onread->IsFunction()\n\n 1: node::Assert(node::AssertionInfo const&)\n 2: node::StreamBase::CallJSOnreadMethod(...)\n 3: node::http2::Http2StreamListener::OnStreamRead(long, uv_buf_t const&)\n 4: node::http2::Http2Session::OnDataChunkReceived(nghttp2_session*, unsigned char, int, unsigned char const*, unsigned long, void*)\n 5: nghttp2_session_mem_recv2\n 6: node::http2::Http2Session::ConsumeHTTP2Data()\n 7: node::http2::Http2Session::OnStreamRead(long, uv_buf_t const&)\n```\n\n`handle.onread` is assigned in exactly one place — `Http2Stream[kInit]` in `lib/internal/http2/core.js` — so nghttp2 is delivering a DATA chunk to a stream whose JS wrapper has already been torn down.\n\nThis is reachable from ordinary peer behaviour: the server simply destroys its own session from the `'stream'` handler, which runs inside `ConsumeHTTP2Data()`.\n\n## Minimal reproduction\n\nNo dependencies, no TLS. Aborts within a few hundred rounds, typically well under the 5s default window:\n\n```js\n'use strict'\n\n// Standalone reproduction — node:http2 only, no dependencies.\n//\n// An HTTP/2 server destroys its own session from inside the 'stream' handler,\n// which nghttp2 dispatches from within Http2Session::ConsumeHTTP2Data. The\n// client sends several concurrent POSTs whose HEADERS and DATA arrive in the\n// same receive buffer, so nghttp2 keeps delivering DATA for the remaining\n// streams after JS has torn the session down. Delivery then reaches a stream\n// whose JS wrapper is gone:\n//\n//   node::StreamBase::CallJSOnreadMethod at ../src/stream_base.cc:473\n//   Assertion failed: onread->IsFunction()\n//     \u003c- node::http2::Http2StreamListener::OnStreamRead\n//     \u003c- node::http2::Http2Session::OnDataChunkReceived\n//     \u003c- nghttp2_session_mem_recv2\n//     \u003c- node::http2::Http2Session::ConsumeHTTP2Data\n//\n// handle.onread is assigned in exactly one place, Http2Stream[kInit]\n// (lib/internal/http2/core.js), so the C++ side is calling into a stream that\n// was destroyed while the receive operation was still in flight.\n//\n// Usage:\n//   node repro-h2-abort.js\n//\n// Exit status 134 (SIGABRT) means it reproduced; 0 means it survived the run.\n// Reproduces over cleartext h2 (and equally over TLS), and does not depend on\n// --expose-gc.\n\nconst http2 = require('node:http2')\n\nconst DURATION = Number(process.env.DURATION || 5000)\nconst STREAMS = Number(process.env.STREAMS || 8)\n// Small enough that HEADERS and DATA coalesce into a single read.\nconst BODY = Buffer.alloc(Number(process.env.BODY || 2048), 'a')\n\nconst serverOptions = {\n  settings: { maxConcurrentStreams: Number(process.env.MAX_CONCURRENT_STREAMS || 4) }\n}\n\nconst server = http2.createServer(serverOptions)\n\nserver.on('session', (session) => session.on('error', () => {}))\n\n// The whole trigger: tear the connection down from inside the stream handler,\n// i.e. while nghttp2 is still walking the buffer that delivered this stream.\nserver.on('stream', (stream) => {\n  stream.on('error', () => {})\n  stream.session.destroy()\n})\n\nlet rounds = 0\n\nserver.listen(0, '127.0.0.1', () => {\n  const port = server.address().port\n  const origin = `http://127.0.0.1:${port}`\n  let stopped = false\n\n  const round = () => {\n    if (stopped) return\n    rounds++\n\n    const session = http2.connect(origin)\n    session.on('error', () => {})\n    session.on('close', () => setImmediate(round))\n\n    session.on('connect', () => {\n      for (let i = 0; i \u003c STREAMS; i++) {\n        const stream = session.request({ ':path': `/${i}`, ':method': 'POST' })\n        stream.on('error', () => {})\n        stream.resume()\n        stream.end(BODY)\n      }\n    })\n  }\n\n  round()\n\n  setTimeout(() => {\n    stopped = true\n    console.log(`survived ${rounds} rounds without aborting`)\n    server.close()\n    process.exit(0)\n  }, DURATION)\n})\n\n```\n\n```console\n$ node repro-h2-abort.js\nAssertion failed: onread->IsFunction()\nAborted (core dumped)\n$ echo $?\n134\n```\n\nDoes not depend on `--expose-gc` (4/4 with and without). Reproduces over TLS as well; the `TLSWrap::ClearOut` frame in the original stack was incidental.\n\n## Affected versions\n\n| build | result (3 runs each) |\n|---|---|\n| `main` @ `012ecf51d39`, clean checkout | **3/3 abort** |\n| v24.18.0 (release binary) | 0/3 — ~6,000 rounds clean |\n| v22.22.3 (release binary) | 0/3 — ~6,000 rounds clean |\n\n## Bisect\n\nIntroduced by **46de80de88c6ab0fc1fa27aa4d51804c7e989da4** — *http2: avoid uaf while receiving and sending rst_stream* (#64166, fixing #64113):\n\n```\n46de80de88c    BAD  (rc=134)\n46de80de88c~1  GOOD\n```\n\nThat commit defers session close while `nghttp2_session_mem_recv()` is in progress:\n\n```cpp\nif (is_receiving()) {\n  set_close_pending();\n  pending_close_code_ = code;\n  pending_close_socket_closed_ = socket_closed;\n  return;   // finished later via MaybeFinishPendingClose()\n}\n```\n\nOur reproduction destroys the session from inside a `'stream'` handler, i.e. *while receiving*. Before that change the close completed immediately and the torn-down streams stopped receiving data. With the close deferred, nghttp2 keeps walking the same receive buffer and delivers DATA to streams whose JS wrappers have already been destroyed, so `CallJSOnreadMethod` finds `onread` unset.\n\nSo the fix for one use-after-free in the `mem_recv` window appears to have opened a different lifetime hole in the same window. Note this is *not* addressed by `ba6cb5c34c2` (*http2: defer rst stream while in scope*) — I cherry-picked that on top and it still aborts 5/5.\n\n## Discovery\n\nFound via `undici`'s HTTP/2 test suite, where it surfaced under `borp` as a bare `'test failed'` with one subtest silently missing and no assertion text — worth knowing, since that signature is easy to mistake for flakiness. Running the test file directly is what exposes exit 134.\n\ncc @Eusgor @mcollina @pimterry @RafaelGSS\n","author":{"url":"https://github.com/mcollina","@type":"Person","name":"mcollina"},"datePublished":"2026-07-30T19:55:21Z","url":"https://github.com/nodejs/node/issues/64850"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:19191e2b-88eb-6f65-34f0-b8953d706781
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA8D4:137C1B:6223DE:7FC66C:6AED2C93
html-safe-nonce197c823ce5b232b04780f122dfc302b174ae64d421ea5f14bffa550f536df6d6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOEQ0OjEzN0MxQjo2MjIzREU6N0ZDNjZDOjZBRUQyQzkzIiwidmlzaXRvcl9pZCI6IjUyNDYzNjUzNzYzNDQ1NjY5MzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac2f5323286a01a10a5c6a1592799be909854e89554a1acaadc3aa35febcbacb51
hovercard-subject-tagissue:5023486617
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/64850/issue_layout
twitter:imagehttps://opengraph.githubassets.com/75e1960a967a5efef0b6737646ded8a1086a4f1f58df4777c0f0ccea0c852dd1/nodejs/node/issues/64850
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/75e1960a967a5efef0b6737646ded8a1086a4f1f58df4777c0f0ccea0c852dd1/nodejs/node/issues/64850
og:image:altWhat steps will reproduce the bug? node:http2 aborts on an internal assertion when an HTTP/2 session is destroyed from inside a 'stream' handler while the peer's DATA frames are still in the receiv...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemcollina
hostnamegithub.com
expected-hostnamegithub.com
Nonee51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a
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
release59ebb7b901cc154ecc179a44f266fcf69f343b30
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/64850#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F64850
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%2F64850
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/64850
Reloadhttps://github.com/nodejs/node/issues/64850
Reloadhttps://github.com/nodejs/node/issues/64850
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues656 (656)https://github.com/nodejs/node/issues
Pull requests666 (666)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/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/64850
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/64850
nodejs/undici#5961https://github.com/nodejs/undici/pull/5961
http2: assertion failure onread->IsFunction() when a session is destroyed from a 'stream' handlerhttps://github.com/nodejs/node/issues/64850#top
nodejs/undici#5961https://github.com/nodejs/undici/pull/5961
https://github.com/mcollina
https://github.com/mcollina
mcollinahttps://github.com/mcollina
on Jul 30, 2026https://github.com/nodejs/node/issues/64850#issue-5023486617
46de80dhttps://github.com/nodejs/node/commit/46de80de88c6ab0fc1fa27aa4d51804c7e989da4
#64166https://github.com/nodejs/node/pull/64166
#64113https://github.com/nodejs/node/issues/64113
@Eusgorhttps://github.com/Eusgor
@mcollinahttps://github.com/mcollina
@pimterryhttps://github.com/pimterry
@RafaelGSShttps://github.com/RafaelGSS
mcollinahttps://github.com/mcollina
on Jul 30, 2026https://github.com/nodejs/node/issues/64850#event-28742186602
https://github.com/mcollina
mcollinahttps://github.com/mcollina
on Aug 31, 2026https://github.com/nodejs/node/issues/64850#issuecomment-5476488918
sankalpsthakurhttps://github.com/sankalpsthakur
on Sep 2, 2026https://github.com/nodejs/node/issues/64850#event-30433310112
http2: fix onread assert when destroying session from stream handlerhttps://github.com/sankalpsthakur/node/commit/6405192af8a88377971cf291c43412268e693bda
6405192https://github.com/sankalpsthakur/node/commit/6405192af8a88377971cf291c43412268e693bda
mcollinahttps://github.com/mcollina
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
0e32ee2https://github.com/nodejs/node/commit/0e32ee21149ca4955fce7b377fa70cef90c9dfc2
on Sep 14, 2026https://github.com/nodejs/node/issues/64850#event-31091416940
pullhttps://github.com/apps/pull
on Sep 14, 2026https://github.com/nodejs/node/issues/64850#event-31094329110
http2: fix onread assert when destroying session from stream handlerhttps://github.com/LuckQuack/node/commit/0e32ee21149ca4955fce7b377fa70cef90c9dfc2
0e32ee2https://github.com/LuckQuack/node/commit/0e32ee21149ca4955fce7b377fa70cef90c9dfc2
aduh95https://github.com/aduh95
on Sep 16, 2026https://github.com/nodejs/node/issues/64850#event-31270408355
http2: fix onread assert when destroying session from stream handlerhttps://github.com/nodejs/node/commit/205443721d214ceb683dbd57e41d4e3df04ffd70
2054437https://github.com/nodejs/node/commit/205443721d214ceb683dbd57e41d4e3df04ffd70
http2: fix onread assert when destroying session from stream handlerhttps://github.com/nodejs/node/commit/0a14c255a155ac2867c1ff91b2399bcb2c90f7f0
0a14c25https://github.com/nodejs/node/commit/0a14c255a155ac2867c1ff91b2399bcb2c90f7f0
http2: fix onread assert when destroying session from stream handlerhttps://github.com/nodejs/node/commit/9a2f77a3fc7c6e55c3cbf102c6378d8eee8df85b
9a2f77ahttps://github.com/nodejs/node/commit/9a2f77a3fc7c6e55c3cbf102c6378d8eee8df85b
cursorhttps://github.com/apps/cursor
on Sep 30, 2026https://github.com/nodejs/node/issues/64850#event-32168706754
test: defer h2 session destroy past nghttp2 mem_recvhttps://github.com/Yahiro025/undici/commit/2529210cbb5c014830b516de17e0c1417f65d1f6
2529210https://github.com/Yahiro025/undici/commit/2529210cbb5c014830b516de17e0c1417f65d1f6
mcollinahttps://github.com/mcollina
on Oct 4, 2026https://github.com/nodejs/node/issues/64850#event-32461463229
http2: fix onread assert when destroying session from stream handlerhttps://github.com/mcollina/node/commit/144217392bebfc8166a626ed9b916758f1dd5873
1442173https://github.com/mcollina/node/commit/144217392bebfc8166a626ed9b916758f1dd5873
test: re-enable HTTP/2 churn test on Node.js 26, keep skipping on Nod…https://github.com/mcollina/undici/commit/dd6cd49a6c142b9ce1a0bc680a451887974a1fbd
dd6cd49https://github.com/mcollina/undici/commit/dd6cd49a6c142b9ce1a0bc680a451887974a1fbd
test: re-enable HTTP/2 churn test on Node.js 26, keep skipping on Nod…https://github.com/nodejs/undici/commit/d2c2ac2b9f6f16eef89deb2dc741d38e1d224068
d2c2ac2https://github.com/nodejs/undici/commit/d2c2ac2b9f6f16eef89deb2dc741d38e1d224068
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/64850
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/64850
mcollinahttps://github.com/mcollina
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

Viewport: width=device-width


URLs of crawlers that visited me.