electron: Apple Silicon 11.x web assembly fails to load

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    • 11.2.1
  • Operating System:
    • macOS 11.1 - M1, Apple Silicon, ARM64

Expected Behavior

Web Assembly should work or at the very least throw a relevant error message

Actual Behavior

Creating a new WebAssembly.Module instance causes a complete loading failure of electron and does not provide any sort of relevant error message.

To Reproduce

Electron Fiddle with gist https://gist.github.com/34ba76d876169d5a101362f47451fba3

const wasmObjectCode = Buffer.from('0061736d01000000018580808000016000017f0382808080000100048480808000017000000583808080000100010681808080000007988080800002066d656d6f727902000b5f5a37676574466976657600000a8a808080000184808080000041050b', 'hex');

const wasmModule = new WebAssembly.Module(wasmObjectCode);

Additional Information

This only fails on 11.x on the m1 chip.

  • m1 chip electron 12.x: success
  • m1 chip electron 11.x: failure
  • x86 chip electron 12.x: success
  • x86 chip electron 11.x: success

This is likely a node issue according to https://github.com/dcodeIO/long.js/issues/95

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 18 (11 by maintainers)

Commits related to this issue

Most upvoted comments

There were two issues with loading wasm in Electron on mac arm64

  1. OOM crash - this was fixed by https://github.com/electron/electron/pull/26650 , as long as your renderer helper is codesigned with com.apple.security.cs.allow-jit it should load the module fine. This is available from v11.0.3

  2. with macOS > 11.2 , crash when loading wasm in node process spawned from the app - this is due to https://bugs.chromium.org/p/v8/issues/detail?id=11389 and is fixed by https://github.com/electron/electron/pull/27684

So depending on your use case, you might have to pick the version.

+1. This is currently an issue as described above on the Apple DTK, FWIW.