analysis/v8-crash-retry-solution.md
CI jobs occasionally fail with a transient V8 bytecode deserialization crash during the Node.js setup phase. The error manifests as:
Fatal error in , line 0
Check failed: ReadSingleBytecodeData( source_.Get(), SlotAccessorForHandle<IsolateT>(&ret, isolate())) == 1.
This error occurs during the yarn cache dir command execution within the actions/setup-node@v4 action.
This is a known bug in Node.js/V8 that occurs sporadically:
The crash happens when V8 attempts to deserialize cached bytecode and encounters corrupted or incompatible data. It's a transient issue that typically resolves on retry.
Before this fix, the codebase used two workarounds:
Completely disable yarn caching in examples.yml:
# TODO: Re-enable yarn caching once Node.js V8 cache crash is fixed
# Tracking: https://github.com/actions/setup-node/issues/1028
# cache: yarn
# cache-dependency-path: '**/yarn.lock'
Conditionally disable caching for Node 22 in integration-tests.yml:
cache: ${{ matrix.node-version != '22' && 'yarn' || '' }}
Both workarounds significantly slowed down CI by preventing yarn dependency caching.
Created a custom composite GitHub action at .github/actions/setup-node-with-retry/ that:
yarn cache dir works before running setup-nodeactions/setup-node@v4- name: Setup Node.js with retry
shell: bash
run: |
# Pre-validate yarn cache dir works
if timeout 30 yarn cache dir > "$TEMP_OUTPUT" 2>&1; then
echo "Yarn cache dir command succeeded"
else
# Check for V8 crash signature
if grep -q "Fatal error in.*Check failed: ReadSingleBytecodeData" "$TEMP_OUTPUT"; then
echo "::warning::V8 bytecode deserialization error detected"
# Retry logic...
fi
fi
- name: Actually setup Node.js
uses: actions/setup-node@v4
# ... standard setup-node configuration
- name: Setup Node
uses: ./.github/actions/setup-node-with-retry
with:
node-version: 22
cache: yarn
cache-dependency-path: '**/yarn.lock'
max-retries: 3 # Optional, defaults to 3
Updated all 8 CI workflow files to use the new action:
examples.yml - Re-enabled yarn cachingintegration-tests.yml - Re-enabled yarn caching for Node 22lint-js-and-ruby.ymlpackage-js-tests.ymlplaywright.ymlpro-integration-tests.ymlpro-lint.ymlpro-test-package-and-gem.ymlTo verify the retry logic is working when V8 crashes occur:
Watch CI logs for these warning messages:
::warning::V8 bytecode deserialization error detected (attempt 1/3)
Retrying in 5 seconds...
Check that jobs succeed after retry instead of failing
If a job exhausts all retries, it will show:
::error::All 3 retry attempts failed
yarn cache dirIf the V8 crash persists even with retries, consider:
jg-/ci-retry-v8-crash