-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: throw error if running x64 node on mac arm64 #14288
Conversation
Hi! Chrome dev here from the filed https://crbug.com/1305353. Your analysis is mostly correct. Chrome ships with both x64 and arm64 (“universal”) so that we can offer one download for users that will work natively with whatever Mac they have. If you run an x64 binary on an Arm Mac under Rosetta and then it spawn subprocesses, macOS will indeed cause all the subprocesses to also be run under Rosetta.
No hybridization, just Rosetta doing its thing on the x64 version inside the universal Chrome binary. Thank you for bringing this to our attention. The correct thing to do is what you have done, to avoid Rosetta entirely by only running arm64 binaries on your arm64 Mac. In the Chromium bug mentioned earlier, we will be doing more to enforce this on Chrome’s end. Running Chrome under Rosetta is not a tested configuration. We thought it was just slow, but if it’s also spewing errors (as you note), we should disallow it if possible. Thank you for reaching out! |
Awesome, thanks @avidrissman! |
btw this is because Chrome on mac ships as a universal binary, thus it has both arm and x64 binaries. So launching a child process from an x64 process will grab the x64, even if on arm64 and an arm64 implementation is present. |
https://docs.google.com/document/d/1hEt6q0BlZ1c50UNhm9ejXNKLvcOX8pStspCY6hAKwDI/edit# (can just read the most recent update, pasted below).
This PR fixes (well, at least warns about)
yarn smoke perf-preload
on my machine.For pretty much any CLI invocation – (spawning chrome from my x64 Node install...apparently 14.20 is only distributed as x64 via nvm. arm64 only became a thing sometime in 15.x) – Chrome would get "translated" to some weird hybrid x64->arm64 binary (even tho the Chrome install is already arm64?!). That resulted in ~10x perf regressions all throughout Chrome. Any test that was perf-sensitive ... like
perf-preload
... was bound to fail.Initially I sought to grab the arch from Browser.getVersion, but it isn't exposed there. And what chrome://version uses is not easily exposable to CDP. So let's just detect the case where we know Rosetta would kick in - from an x64 node binary running on mac arm64.