Skip to content

Apple Silicon / arm64 / M1 compatibility? #259

Closed
@eugene1g

Description

@eugene1g

Hi,

We're using & loving react-refresh-webpack-plugin - thank you!

Recently Apple Silicon came out with arch64-based CPUs. Somehow, this plugin breaks on that architecture with a strange error as reported at facebook/create-react-app#10090

The error looks like this on node=15.2.1 npm=7.0.10 platform=darwin arch=arm64 -

Starting the development server...


<--- Last few GCs --->

[23567:0x148008000]      705 ms: Scavenge 62.1 (89.8) -> 51.2 (89.8) MB, 1.0 / 0.0 ms  (average mu = 0.992, current mu = 0.992) allocation failure 
[23567:0x148008000]      784 ms: Scavenge 67.7 (90.0) -> 57.3 (91.7) MB, 1.2 / 0.0 ms  (average mu = 0.992, current mu = 0.992) allocation failure 


<--- JS stacktrace --->

FATAL ERROR: WasmCodeManager::Commit: Cannot make pre-reserved region writable Allocation failed - process out of memory
 1: 0x10053def4 node::Abort() [/opt/homebrew/Cellar/node/15.2.1/bin/node]
 2: 0x10053e074 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<std::nullptr_t>(char const*) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
 3: 0x100663dd8 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
 4: 0x100663d6c v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
 5: 0x100b00418 v8::internal::wasm::WasmCodeManager::Commit(v8::base::AddressRegion) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
 6: 0x100b00008 v8::internal::wasm::WasmCodeAllocator::AllocateForCodeInRegion(v8::internal::wasm::NativeModule*, unsigned long, v8::base::AddressRegion, v8::internal::wasm::WasmCodeAllocator::OptionalLock const&) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
 7: 0x100b00cfc v8::internal::wasm::NativeModule::CreateEmptyJumpTableInRegion(int, v8::base::AddressRegion, v8::internal::wasm::WasmCodeAllocator::OptionalLock const&) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
 8: 0x100affc18 v8::internal::wasm::NativeModule::AddCodeSpace(v8::base::AddressRegion, v8::internal::wasm::WasmCodeAllocator::OptionalLock const&) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
 9: 0x100b00b18 v8::internal::wasm::NativeModule::NativeModule(v8::internal::wasm::WasmEngine*, v8::internal::wasm::WasmFeatures const&, v8::internal::VirtualMemory, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>, std::__1::shared_ptr<v8::internal::Counters>, std::__1::shared_ptr<v8::internal::wasm::NativeModule>*) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
10: 0x100b02b78 v8::internal::wasm::WasmCodeManager::NewNativeModule(v8::internal::wasm::WasmEngine*, v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, unsigned long, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
11: 0x100b0f320 v8::internal::wasm::WasmEngine::NewNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>, unsigned long) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
12: 0x100adeee0 v8::internal::wasm::AsyncCompileJob::CreateNativeModule(std::__1::shared_ptr<v8::internal::wasm::WasmModule const>, unsigned long) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
13: 0x100adf094 v8::internal::wasm::AsyncCompileJob::GetOrCreateNativeModule(std::__1::shared_ptr<v8::internal::wasm::WasmModule const>, unsigned long) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
14: 0x100ae6ec8 v8::internal::wasm::AsyncCompileJob::PrepareAndStartCompile::RunInForeground(v8::internal::wasm::AsyncCompileJob*) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
15: 0x100ae6cf0 v8::internal::wasm::AsyncCompileJob::CompileStep::Run(v8::internal::wasm::AsyncCompileJob*, bool) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
16: 0x100ae6c00 v8::internal::wasm::AsyncCompileJob::CompileTask::RunInternal() [/opt/homebrew/Cellar/node/15.2.1/bin/node]
17: 0x100592aa0 node::PerIsolatePlatformData::RunForegroundTask(std::__1::unique_ptr<v8::Task, std::__1::default_delete<v8::Task> >) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
18: 0x100591b94 node::PerIsolatePlatformData::FlushForegroundTasksInternal() [/opt/homebrew/Cellar/node/15.2.1/bin/node]
19: 0x100c0527c uv__async_io [/opt/homebrew/Cellar/node/15.2.1/bin/node]
20: 0x100c14df0 uv__io_poll [/opt/homebrew/Cellar/node/15.2.1/bin/node]
21: 0x100c0569c uv_run [/opt/homebrew/Cellar/node/15.2.1/bin/node]
22: 0x1004a3960 node::SpinEventLoop(node::Environment*) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
23: 0x100571ef8 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
24: 0x100518ff4 node::Start(int, char**) [/opt/homebrew/Cellar/node/15.2.1/bin/node]
25: 0x190ae8f54 start [/usr/lib/system/libdyld.dylib]

The reproduction case is simple -

npx create-react-app my-app
cd my-app
npm start # Triggers the errors
env FAST_REFRESH=false npm start   # <-- The app work

I do not use create-react-app, and use this plugin directly - but experience exactly the same failure case with webpack 4 as in that issue. If I comment out the line that adds this plugin and make no other changes, everything else works as expected.

Do you have any guesses why the plugin would fail with WASM-related errors on the Apple arch64 / M1 chip?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions