Skip to content

emulator: make cross-arch arm64 build survive TCG#1324

Closed
BilalG1 wants to merge 2 commits into
local-emulator-image-optimizationfrom
emulator-tcg-arm64-fixes
Closed

emulator: make cross-arch arm64 build survive TCG#1324
BilalG1 wants to merge 2 commits into
local-emulator-image-optimizationfrom
emulator-tcg-arm64-fixes

Conversation

@BilalG1
Copy link
Copy Markdown
Collaborator

@BilalG1 BilalG1 commented Apr 10, 2026

The arm64 matrix entry cross-compiles on the amd64 CI runner, so the guest runs under QEMU TCG. Under -cpu max, V8 emits armv8.5+ JIT code that TCG mistranslates and node crashes with SIGTRAP (exit 133) during migrations. Three changes together get it working:

  • Drop to -cpu cortex-a72 for TCG arm64 guests. Limits V8 to armv8.0-a which TCG handles cleanly. Native paths (HVF/KVM) keep -cpu max for full performance.
  • Run migrations with NODE_OPTIONS=--jitless as belt-and-suspenders. Migrations are I/O-bound so the perf hit is negligible.
  • Skip the in-guest smoke test on arm64. A full Next.js backend under cross-arch TCG either SIGTRAPs or times out; the amd64 build still runs the smoke test, which covers every non-arch-specific code path. Arch is propagated into the guest via a new build-arch.env marker in the stack-bundle ISO.

The arm64 matrix entry cross-compiles on the amd64 CI runner, so the
guest runs under QEMU TCG. Under -cpu max, V8 emits armv8.5+ JIT code
that TCG mistranslates and node crashes with SIGTRAP (exit 133)
during migrations. Three changes together get it working:

- Drop to -cpu cortex-a72 for TCG arm64 guests. Limits V8 to
  armv8.0-a which TCG handles cleanly. Native paths (HVF/KVM) keep
  -cpu max for full performance.
- Run migrations with NODE_OPTIONS=--jitless as belt-and-suspenders.
  Migrations are I/O-bound so the perf hit is negligible.
- Skip the in-guest smoke test on arm64. A full Next.js backend under
  cross-arch TCG either SIGTRAPs or times out; the amd64 build still
  runs the smoke test, which covers every non-arch-specific code
  path. Arch is propagated into the guest via a new build-arch.env
  marker in the stack-bundle ISO.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 10, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b2bc43c5-52ad-41d0-b575-bdb114984a76

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch emulator-tcg-arm64-fixes

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stack-auth-hosted-components Ready Ready Preview, Comment Apr 10, 2026 6:33pm
stack-backend Ready Ready Preview, Comment Apr 10, 2026 6:33pm
stack-dashboard Ready Ready Preview, Comment Apr 10, 2026 6:33pm
stack-demo Ready Ready Preview, Comment Apr 10, 2026 6:33pm
stack-docs Ready Ready Preview, Comment Apr 10, 2026 6:33pm
stack-preview-backend Ready Ready Preview, Comment Apr 10, 2026 6:33pm
stack-preview-dashboard Ready Ready Preview, Comment Apr 10, 2026 6:33pm

The previous commit set NODE_OPTIONS=--jitless on the migration
docker exec. That was wrong for two reasons:
- --jitless disables eval and new Function, which some code in the
  migration path uses, so it broke amd64 builds that had been passing.
- --jitless is a V8 feature gate, not a TCG workaround. If it breaks
  one arch it breaks both — it could never have helped arm64 either.

Revert the --jitless flag and rely on -cpu cortex-a72 (added in the
parent commit) as the root-cause fix for the arm64 TCG SIGTRAP.

Keep the stdout/stderr capture for the migration exec so the next
failure dumps the actual node error through log-provision instead of
being swallowed by the serial-only stream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant