Title: Worker with large inline source map aborts process in V8 HandleDebugMagicComments · Issue #64155 · nodejs/node · GitHub
Open Graph Title: Worker with large inline source map aborts process in V8 HandleDebugMagicComments · Issue #64155 · nodejs/node
X Title: Worker with large inline source map aborts process in V8 HandleDebugMagicComments · Issue #64155 · nodejs/node
Description: Version v26.4.0 Platform macOS 15.x arm64 Subsystem worker_threads What steps will reproduce the bug? Create a worker entry file with a small amount of executable JavaScript and a very large inline sourceMappingURL=data:... comment, then...
Open Graph Description: Version v26.4.0 Platform macOS 15.x arm64 Subsystem worker_threads What steps will reproduce the bug? Create a worker entry file with a small amount of executable JavaScript and a very large inline...
X Description: Version v26.4.0 Platform macOS 15.x arm64 Subsystem worker_threads What steps will reproduce the bug? Create a worker entry file with a small amount of executable JavaScript and a very large inline...
Opengraph URL: https://github.com/nodejs/node/issues/64155
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Worker with large inline source map aborts process in V8 HandleDebugMagicComments","articleBody":"### Version\n\nv26.4.0\n\n### Platform\n\n```text\nmacOS 15.x arm64\n```\n\n### Subsystem\n\nworker_threads\n\n### What steps will reproduce the bug?\n\nCreate a worker entry file with a small amount of executable JavaScript and a very large inline `sourceMappingURL=data:...` comment, then load it in a worker with a constrained heap.\n\nMinimal repro:\n\n```js\nconst fs = require(\"node:fs\");\nconst os = require(\"node:os\");\nconst path = require(\"node:path\");\nconst { Worker } = require(\"node:worker_threads\");\n\nconst dir = fs.mkdtempSync(path.join(os.tmpdir(), \"node-inline-sourcemap-oom-\"));\n\nconst workerPath = path.join(dir, \"worker.cjs\");\n\nconst source = [\n 'const { parentPort } = require(\"node:worker_threads\");',\n 'parentPort.postMessage(\"loaded\");',\n 'parentPort.close();',\n \"\",\n \"//# sourceMappingURL=data:application/json;base64,\",\n \"A\".repeat(64 * 1024 * 1024),\n \"\",\n].join(\"\\n\");\n\nfs.writeFileSync(workerPath, source);\n\nconst worker = new Worker(workerPath, {\n resourceLimits: {\n maxOldGenerationSizeMb: 16,\n },\n});\n\nworker.on(\"message\", console.log);\n\nworker.on(\"error\", console.error);\n\nworker.on(\"exit\", (code) => {\n console.log(\"exit\", code);\n fs.rmSync(dir, { recursive: true, force: true });\n});\n```\n\nRun: `node repro.js`\n\n\n\n### How often does it reproduce? Is there a required condition?\n\nIt reproduces consistently when the inline sourcemap comment is large enough relative to the worker heap limit.\n\nFor comparison, these do not reproduce the same fatal abort:\n\n1. Keeping the same large payload in an external worker.cjs.map file and using //# sourceMappingURL=worker.cjs.map.\n2. Putting a similarly large payload in a normal non-sourceMappingURL comment.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe worker should fail gracefully, for example by emitting an error event or exiting with a worker failure, without aborting the entire Node.js process.\n\nIdeally, parsing sourceMappingURL / debug magic comments should not internalize an arbitrarily large data URL into V8 old space during module compilation.\n\n### What do you see instead?\n\nThe whole Node process aborts with an out-of-memory fatal error before the worker can load the module.\n\nExample stack from Node v26.4.0:\n```\nFATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory\n...\nv8::internal::FactoryBase\u003cv8::internal::Factory>::AllocateRawOneByteInternalizedString\nv8::internal::FactoryBase\u003cv8::internal::Factory>::NewOneByteInternalizedString\nv8::internal::StringTable::LookupKey\nv8::internal::FactoryBase\u003cv8::internal::Factory>::InternalizeString\nvoid v8::internal::Parser::HandleDebugMagicComments\nv8::internal::Parser::ParseProgram\nv8::internal::parsing::ParseProgram\nv8::internal::Compiler::GetWrappedFunction\nv8::ScriptCompiler::CompileFunction\nnode::contextify::CompileFunctionForCJSLoader\nnode::worker::Worker::Run\n```\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/mathieudutour","@type":"Person","name":"mathieudutour"},"datePublished":"2026-06-26T16:40:19Z","url":"https://github.com/nodejs/node/issues/64155"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2d47efb0-3540-3aa4-9429-2ce3177d9317 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 840A:261555:159B9B:1D545B:6AFBFC89 |
| html-safe-nonce | 147c7da9ea345a23429356a634c58f792ed69d58d853f16019673efe246d81b8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDBBOjI2MTU1NToxNTlCOUI6MUQ1NDVCOjZBRkJGQzg5IiwidmlzaXRvcl9pZCI6IjUxMDM1NzQyNzUxNDc0MzEwNDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0b43d005a83c62a7551bf9212ba9e0b4ff7996bebfeca6bf78629ada961642e8 |
| hovercard-subject-tag | issue:4753605405 |
| 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/64155/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3e7e9770d935812a1e379acff6be61dad0c76216e85f6fce511883915edd13a9/nodejs/node/issues/64155 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3e7e9770d935812a1e379acff6be61dad0c76216e85f6fce511883915edd13a9/nodejs/node/issues/64155 |
| og:image:alt | Version v26.4.0 Platform macOS 15.x arm64 Subsystem worker_threads What steps will reproduce the bug? Create a worker entry file with a small amount of executable JavaScript and a very large inline... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mathieudutour |
| hostname | github.com |
| expected-hostname | github.com |
| None | fa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f |
| 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 | b3b5633a74535d9c23385512d534c66c8fde1907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width