René's URL Explorer Experiment


Title: test_runner: infinite loop in FileTest#drainRawBuffer when child stdout contains FF 0F followed by large size bytes · Issue #62693 · nodejs/node · GitHub

Open Graph Title: test_runner: infinite loop in FileTest#drainRawBuffer when child stdout contains FF 0F followed by large size bytes · Issue #62693 · nodejs/node

X Title: test_runner: infinite loop in FileTest#drainRawBuffer when child stdout contains FF 0F followed by large size bytes · Issue #62693 · nodejs/node

Description: Version v25.9.0 (also reproduced on v24.14.1 LTS, v22.21.0 LTS, v23.4.0) Platform Darwin 25.3.0 Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:05 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6020 arm64 Bug is architectural (not OS-spec...

Open Graph Description: Version v25.9.0 (also reproduced on v24.14.1 LTS, v22.21.0 LTS, v23.4.0) Platform Darwin 25.3.0 Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:05 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6020...

X Description: Version v25.9.0 (also reproduced on v24.14.1 LTS, v22.21.0 LTS, v23.4.0) Platform Darwin 25.3.0 Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:05 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6020...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"test_runner: infinite loop in FileTest#drainRawBuffer when child stdout contains FF 0F followed by large size bytes","articleBody":"### Version\nv25.9.0 (also reproduced on v24.14.1 LTS, v22.21.0 LTS, v23.4.0)\n\n### Platform\n```\nDarwin 25.3.0 Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:05 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6020 arm64\n```\nBug is architectural (not OS-specific) — it's in the JS code of `lib/internal/test_runner/runner.js`.\n\n### Subsystem\ntest_runner\n\n### What steps will reproduce the bug?\n\nSave as `repro.mjs`:\n\n```js\nimport { test } from 'node:test';\n\ntest('hang', () =\u003e {\n  // v8Header is [0xFF, 0x0F]. The next 4 bytes are parsed as a\n  // big-endian \"full message size\". 0x7FFFFFFF is much larger than\n  // any rawBufferSize this child will ever reach.\n  process.stdout.write(Buffer.from([0xff, 0x0f, 0x7f, 0xff, 0xff, 0xff]));\n});\n```\n\nRun:\n\n```\nnode --test --test-force-exit repro.mjs\n```\n\nThe process hangs at 100 % CPU forever. Reproduces with and without `--test-force-exit`. `--test-timeout` cannot recover the process because the main thread is 100 % in JS microtasks — the event loop is starved. `SIGTERM` is ignored; only `SIGKILL` stops it.\n\n### How often does it reproduce? Is there a required condition?\n\n100 % deterministic with those exact 6 bytes on v22.21.0, v23.4.0, v24.14.1, and v25.9.0. Required condition: the child's stdout must contain the sequence `0xFF 0x0F` followed by 4 bytes that, read as a big-endian uint32, exceed the parser's accumulated `#rawBufferSize`. Any child stdout containing `FF 0F` near the start followed by arbitrary bytes is vulnerable — I first hit this in the wild via a test that wrote random binary output and intermittently hung roughly one run in five.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nEither the parser treats unrecognized/oversized frames as normal stdout and keeps draining, or `#drainRawBuffer` detects no-progress iterations and breaks. Test runner output framing must be robust against arbitrary child stdout content; user tests cannot reasonably be required to avoid a particular byte sequence.\n\n### What do you see instead?\n\nInfinite loop in the parent test-runner process while handling the worker's `OnExit` callback. `sample`/`lldb` show:\n\n```\nuv_run → uv__wait_children → ProcessWrap::OnExit → MakeCallback\n → MicrotaskQueue::PerformCheckpointInternal → RunMicrotasks\n → PromiseFulfillReactionJob → AsyncFunctionAwaitResolveClosure\n → [interpreted frames] → Builtins_CreateTypedArray\n → Runtime_AllocateInYoungGeneration → Heap::Scavenge\n```\n\n~66 % of main-thread samples in `Heap::Scavenge`, ~670 `FastBuffer`/`TypedArray` allocations per second, `Buffer::IndexOfBuffer` also hot. Memory is flat (~1 GB) — pure alloc/GC churn, not a leak.\n\n### Additional information\n\n**Root cause** — `lib/internal/test_runner/runner.js` on `main`:\n\n```js\n#drainRawBuffer() {\n  while (this.#rawBuffer.length \u003e 0) {          // L366 — no no-progress guard\n    this.#processRawBuffer();\n  }\n}\n\n#processRawBuffer() {\n  let bufferHead = this.#rawBuffer[0];\n  let headerIndex = bufferHead.indexOf(v8Header);\n  let nonSerialized = new FastBuffer();\n\n  while (bufferHead \u0026\u0026 headerIndex !== 0) {     // L376 — skipped when headerIndex === 0\n    …\n  }\n\n  while (bufferHead?.length \u003e= kSerializedSizeHeader) {   // L399\n    const fullMessageSize = (\n      bufferHead[kV8HeaderLength]     \u003c\u003c 24 |\n      bufferHead[kV8HeaderLength + 1] \u003c\u003c 16 |\n      bufferHead[kV8HeaderLength + 2] \u003c\u003c 8  |\n      bufferHead[kV8HeaderLength + 3]\n    ) + kSerializedSizeHeader;\n\n    if (this.#rawBufferSize \u003c fullMessageSize) break;     // L409 — breaks without mutating #rawBuffer\n    …\n  }\n}\n```\n\nWhen the buffer starts with `FF 0F`, the first loop is skipped (`headerIndex === 0`). When the following 4 bytes form a size larger than `#rawBufferSize`, the second loop breaks on its first check. `#processRawBuffer` returns without shrinking `#rawBuffer` or `#rawBufferSize`, and `#drainRawBuffer`'s `while` condition is still true — so it re-enters `#processRawBuffer`, which again allocates a `FastBuffer`, again calls `bufferHead.indexOf(v8Header)`, again breaks on the same check, forever. `#drainRawBuffer` is reached via `drain() → report()` when the subtest file exits, so the hang manifests *after* the test body finishes, on the parent's `ProcessWrap::OnExit` path.\n\nThe framing uses only a 2-byte magic (`v8.Serializer` header `FF 0F`), which is short enough to collide with arbitrary user stdout (random/binary bytes, compressed data, protobuf frames, etc.).\n\n**Suggested fixes** (in order of increasing invasiveness):\n\n1. In `#drainRawBuffer`, track `#rawBufferSize` (and `#rawBuffer.length`) before/after each `#processRawBuffer` call and `break` if neither changed — guarantees termination regardless of content. Cheapest fix.\n2. At drain time (stream closed), if `fullMessageSize \u003e #rawBufferSize` in `#processRawBuffer`'s second loop, treat the leading bytes as corrupted framing and flush them as stdout instead of waiting for more data that will never arrive.\n3. (Long term, breaking protocol change) Use a longer framing magic or an explicit length prefix before `v8Header` so accidental collisions become astronomically unlikely.\n","author":{"url":"https://github.com/lslv1243","@type":"Person","name":"lslv1243"},"datePublished":"2026-04-11T16:28:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/62693/node/issues/62693"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e1d2eeea-910f-6438-703e-1fe838260657
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id844E:3E4802:CDDF67:115ED7F:6A4D4A40
html-safe-noncea5a39dabd9ac1180f517816b840630e57ad1d49289dac63316785b73f456d2db
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDRFOjNFNDgwMjpDRERGNjc6MTE1RUQ3Rjo2QTRENEE0MCIsInZpc2l0b3JfaWQiOiI0ODE3NTUyOTA2OTA5OTY4MDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac7117314a69a0b726d3890e023cd87d2b17e5c66fa9dcafb8b5e8d125aa54d2f7
hovercard-subject-tagissue:4245159069
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/62693/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3b64e7bceb9bbe9ba9103161b9e6865f2a5d4c352bd1b5f0555da0217bcf5b3b/nodejs/node/issues/62693
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3b64e7bceb9bbe9ba9103161b9e6865f2a5d4c352bd1b5f0555da0217bcf5b3b/nodejs/node/issues/62693
og:image:altVersion v25.9.0 (also reproduced on v24.14.1 LTS, v22.21.0 LTS, v23.4.0) Platform Darwin 25.3.0 Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:05 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6020...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamelslv1243
hostnamegithub.com
expected-hostnamegithub.com
None92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6
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
release56fc8347865a14e2ec811533d68f929cf4e0ec19
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/issues/62693#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F62693
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F62693
Sign up https://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/62693
Reloadhttps://github.com/nodejs/node/issues/62693
Reloadhttps://github.com/nodejs/node/issues/62693
Please reload this pagehttps://github.com/nodejs/node/issues/62693
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/issues/62693
Notifications https://github.com/login?return_to=%2Fnodejs%2Fnode
Fork 36k https://github.com/login?return_to=%2Fnodejs%2Fnode
Star 118k https://github.com/login?return_to=%2Fnodejs%2Fnode
Code https://github.com/nodejs/node
Issues 1.4k https://github.com/nodejs/node/issues
Pull requests 959 https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality 0 https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Code https://github.com/nodejs/node
Issues https://github.com/nodejs/node/issues
Pull requests https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
#62704https://github.com/nodejs/node/pull/62704
test_runner: infinite loop in FileTest#drainRawBuffer when child stdout contains FF 0F followed by large size byteshttps://github.com/nodejs/node/issues/62693#top
#62704https://github.com/nodejs/node/pull/62704
confirmed-bugIssues with confirmed bugs.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22confirmed-bug%22
test_runnerIssues and PRs related to the test runner subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22test_runner%22
https://github.com/lslv1243
lslv1243https://github.com/lslv1243
on Apr 11, 2026https://github.com/nodejs/node/issues/62693#issue-4245159069
confirmed-bugIssues with confirmed bugs.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22confirmed-bug%22
test_runnerIssues and PRs related to the test runner subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22test_runner%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

Viewport: width=device-width


URLs of crawlers that visited me.