Title: module.enableCompileCache() never returns on Windows for some cache-directory lengths (spins at 100% CPU) · Issue #66438 · nodejs/node · GitHub
Open Graph Title: module.enableCompileCache() never returns on Windows for some cache-directory lengths (spins at 100% CPU) · Issue #66438 · nodejs/node
X Title: module.enableCompileCache() never returns on Windows for some cache-directory lengths (spins at 100% CPU) · Issue #66438 · nodejs/node
Description: Version v24.18.0 Platform Microsoft Windows 11 Pro 10.0.26200, x64. LongPathsEnabled = 1. Subsystem module (compile cache) What steps will reproduce the bug? Run this PowerShell script. It calls module.enableCompileCache() on directories...
Open Graph Description: Version v24.18.0 Platform Microsoft Windows 11 Pro 10.0.26200, x64. LongPathsEnabled = 1. Subsystem module (compile cache) What steps will reproduce the bug? Run this PowerShell script. It calls mo...
X Description: Version v24.18.0 Platform Microsoft Windows 11 Pro 10.0.26200, x64. LongPathsEnabled = 1. Subsystem module (compile cache) What steps will reproduce the bug? Run this PowerShell script. It calls mo...
Opengraph URL: https://github.com/nodejs/node/issues/66438
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"module.enableCompileCache() never returns on Windows for some cache-directory lengths (spins at 100% CPU)","articleBody":"### Version\n\nv24.18.0\n\n### Platform\n\nMicrosoft Windows 11 Pro 10.0.26200, x64. `LongPathsEnabled` = 1.\n\n### Subsystem\n\nmodule (compile cache)\n\n### What steps will reproduce the bug?\n\nRun this PowerShell script. It calls `module.enableCompileCache()` on directories of different lengths under `%TEMP%`, and kills any call that has not returned after 6 seconds.\n\n```powershell\n$base = Join-Path $env:TEMP 'cc-repro'\nNew-Item -ItemType Directory -Force -Path $base | Out-Null\nforeach ($len in 200, 220, 230, 240, 245, 250, 260, 300) {\n $p = $base; $i = 0\n while ($p.Length -lt $len) { $p = Join-Path $p (\"d\" + ($i++)) }\n $p = $p.Substring(0, $len).TrimEnd('\\')\n $psi = [System.Diagnostics.ProcessStartInfo]::new('node.exe')\n $psi.Arguments = \"-e `\"const r=require('module').enableCompileCache(process.argv[1]);console.log(r.status+' '+(r.message||''))`\" `\"$p`\"\"\n $psi.UseShellExecute = $false; $psi.RedirectStandardOutput = $true\n $proc = [System.Diagnostics.Process]::Start($psi)\n if (-not $proc.WaitForExit(6000)) { $proc.Kill(); \"{0} chars: HANG\" -f $p.Length }\n else { \"{0} chars: {1}\" -f $p.Length, $proc.StandardOutput.ReadToEnd().Trim() }\n}\n```\n\n### How often does it reproduce? Is there a required condition?\n\nIt happens every time for directory lengths 240 and 245, with `%TEMP%` under `C:\\Users\\\u003cuser>\\AppData\\Local\\Temp`. The exact lengths that hang depend on the path's structure. In our case a real 283-character cache path also hung, while the synthetic 282-character path above fails cleanly.\n\n### What is the expected behavior? Why is that the expected behavior?\n\n`enableCompileCache()` should return. It should either enable the cache or report failure, as it does for every other length:\n\n```\n200 chars: 1\n220 chars: 1\n230 chars: 0 Cannot create cache directory: no such file or directory\n234 chars: 0 Cannot create cache directory: no such file or directory\n240 chars: HANG\n245 chars: HANG\n250 chars: 0 Cannot create cache directory: no such file or directory\n260 chars: 0 Cannot create cache directory: no such file or directory\n300 chars: 0 Cannot create cache directory: no such file or directory\n```\n\n### What do you see instead?\n\nThe call never returns. The main thread spins inside native code:\n- One core runs at 100%.\n- Process I/O counters show about 150,000 file-system metadata operations a second (`OtherOperationCount`), with no writes.\n- Timers never fire, and the inspector cannot pause the thread, so neither `--cpu-prof` nor `Debugger.pause` produces a stack.\n- A `--prof` tick profile attributes about 99% of ticks to `ntdll.dll` under the calling script.\n\nThe same hang occurs when the cache is enabled through the `NODE_COMPILE_CACHE` environment variable. In a worker thread, that variable also freezes a main thread that is waiting on the worker.\n\n### Additional information\n\nWe hit this in production: an application enabled the compile cache in its launcher, its entry module and its worker threads, using a cache path built from a long build ID. A maintenance command then spun for 25 minutes before it was killed.\n\nWorkaround: `NODE_DISABLE_COMPILE_CACHE=1`.\n\n`fs.mkdirSync(path, { recursive: true })` succeeds for all of these lengths on the same machine, so the problem appears specific to the compile-cache directory creation path. It may be an `MKDirp` retry loop on ENOENT for paths near `MAX_PATH` without the `\\\\?\\` prefix.\n","author":{"url":"https://github.com/NickM83","@type":"Person","name":"NickM83"},"datePublished":"2026-10-01T15:40:22Z","url":"https://github.com/nodejs/node/issues/66438"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:72e2a4ca-a4a3-4eb3-469e-74e448c698bd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 948C:1463F:675FE6:861F1A:6AED2DA5 |
| html-safe-nonce | a84937afd5dcc3eba5e60aa28ba040854f2f7a085ab78843031d85f9a2157235 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDhDOjE0NjNGOjY3NUZFNjo4NjFGMUE6NkFFRDJEQTUiLCJ2aXNpdG9yX2lkIjoiNjcwMzU0NTUwMzgyMTE0NzU1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5c473f5f13dd2aee39c47c8fa096c24da51268ef28057fc6838ee1b1798e8798 |
| hovercard-subject-tag | issue:5664894515 |
| 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/66438/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ff86023e39d5c3c2a414c0db7d4147a1d502d47aa4f442731880ab1c2ea386c7/nodejs/node/issues/66438 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ff86023e39d5c3c2a414c0db7d4147a1d502d47aa4f442731880ab1c2ea386c7/nodejs/node/issues/66438 |
| og:image:alt | Version v24.18.0 Platform Microsoft Windows 11 Pro 10.0.26200, x64. LongPathsEnabled = 1. Subsystem module (compile cache) What steps will reproduce the bug? Run this PowerShell script. It calls mo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NickM83 |
| hostname | github.com |
| expected-hostname | github.com |
| None | e51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a |
| 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 | 59ebb7b901cc154ecc179a44f266fcf69f343b30 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width