Disabled v8-compile-cache to fix intermittent V8 deserializer crashes#26652
Conversation
WalkthroughThe pull request sets 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26652 +/- ##
=======================================
Coverage 73.20% 73.20%
=======================================
Files 1534 1534
Lines 121034 121034
Branches 14635 14635
=======================================
+ Hits 88598 88599 +1
Misses 31405 31405
+ Partials 1031 1030 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Parallel Nx workers each invoke ts-node to load the TypeScript compiler, which calls v8-compile-cache-lib.install() and races to read/write shared bytecode blob files in /tmp. This causes intermittent fatal crashes: # Fatal error in , line 0 # unreachable code v8::internal::Deserializer::ReadSingleBytecodeData Setting DISABLE_V8_COMPILE_CACHE=1 eliminates the race. There is no performance cost since the cache lives in /tmp and is discarded at the end of each CI run anyway — every run already starts cold. See: nodejs/node#51555 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1a4c084 to
7798580
Compare
troyciesco
left a comment
There was a problem hiding this comment.
lgtm, link to the node issue was extremely helpful.
question/suggestion: does this happen on just browser tests, like the one linked in the description, or any job? (I don't think I've ever run into this before). if it is just on browser tests it might be worth running that once here.
It could happen on any job that builds all the typescript packages - browser tests, acceptance tests, legacy tests, etc, so it's run successfully at least a couple times on this PR 😄 |
Problem
CI intermittently fails with a fatal V8 crash during
Build TS packages:Example failing run: https://github.com/TryGhost/Ghost/actions/runs/22564490904/job/65358043431
Root cause
The dependency chain
ts-node→v8-compile-cache-libis responsible. Whents-nodeloads the TypeScript compiler it callsv8-compile-cache-lib.install(), which caches compiled V8 bytecode to disk in/tmp.With Nx running 4 parallel worker processes (the default), multiple workers call this simultaneously and race to read/write the same blob cache files. This corrupts the bytecode, causing the crash on deserialization.
This is a known Node.js issue: nodejs/node#51555
The Node.js core team confirmed: "Incorrect use of the v8 code cache can lead to corruption and crashes like this... This might be especially true if you have concurrent processes or threads which need careful synchronization."
Fix
Set
DISABLE_V8_COMPILE_CACHE=1globally in the CI workflow environment. This is the confirmed workaround from the Node.js issue thread.Performance impact
None. The bytecode cache is written to
/tmpand discarded at the end of each run — it never persists between CI jobs. Every run was already starting cold.Test plan