I have a nodejs script which was working fine on nodejs 12. I got a new macbook air on which I installed nodejs LTS 14. The scripts was not working as intended so I have downgraded it to nodejs 12 LTS. Now I'm getting an error for process out of memory. I have also tried using --max-oud-size to increase the memory allocation.
export NODE_OPTIONS=--max_old_space_size=4096
It didn't work. Following is the stack trace for the error
<--- Last few GCs --->
[8193:0x150008000] 41 ms: Scavenge 2.9 (4.9) -> 2.7 (5.7) MB, 0.5 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
[8193:0x150008000] 54 ms: Scavenge 3.9 (5.9) -> 3.6 (8.6) MB, 0.3 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
[8193:0x150008000] 59 ms: Scavenge 5.2 (8.6) -> 3.9 (9.1) MB, 0.2 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x00010b1808d1 <JSObject>
0: builtin exit frame: new constructor(aka Module)(this=0x000102ea1961 <Object map = 0x10b3ecbc9>,0x000102ea1811 <Uint8Array map = 0x102fc2b99>,0x000102ea1961 <Object map = 0x10b3ecbc9>)
1: ConstructFrame [pc: 0x100ca8758]
2: StubFrame [pc: 0x100d91204]
3: /* anonymous */ [0x102ea10b1] [/Applications/XAMPP/xamppfiles/htdocs/web-dev/local-cron-jobs/node_modules/long/src/long.js:9...
FATAL ERROR: wasm code commit Allocation failed - process out of memory
1: 0x1004db324 node::Abort() [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
2: 0x1004db4a4 node::errors::TryCatchScope::~TryCatchScope() [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
3: 0x1005fab78 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
4: 0x1005fab0c v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
5: 0x100b332bc v8::internal::wasm::WasmCodeAllocator::AllocateForCodeInRegion(v8::internal::wasm::NativeModule*, unsigned long, v8::base::AddressRegion) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
6: 0x100b34198 v8::internal::wasm::NativeModule::CreateEmptyJumpTableInRegion(unsigned int, v8::base::AddressRegion) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
7: 0x100b33660 v8::internal::wasm::NativeModule::AddCodeSpace(v8::base::AddressRegion) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
8: 0x100b33fd4 v8::internal::wasm::NativeModule::NativeModule(v8::internal::wasm::WasmEngine*, v8::internal::wasm::WasmFeatures const&, bool, 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>*) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
9: 0x100b36214 v8::internal::wasm::WasmCodeManager::NewNativeModule(v8::internal::wasm::WasmEngine*, v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, unsigned long, bool, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
10: 0x100b3cb1c v8::internal::wasm::WasmEngine::NewNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, unsigned long, bool, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
11: 0x100b3ca64 v8::internal::wasm::WasmEngine::NewNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
12: 0x100b14578 v8::internal::wasm::CompileToNativeModule(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, v8::internal::wasm::ErrorThrower*, std::__1::shared_ptr<v8::internal::wasm::WasmModule const>, v8::internal::wasm::ModuleWireBytes const&, v8::internal::Handle<v8::internal::FixedArray>*) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
13: 0x100b3a710 v8::internal::wasm::WasmEngine::SyncCompile(v8::internal::Isolate*, v8::internal::wasm::WasmFeatures const&, v8::internal::wasm::ErrorThrower*, v8::internal::wasm::ModuleWireBytes const&) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
14: 0x100b5bc98 v8::(anonymous namespace)::WebAssemblyModule(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
15: 0x10065f150 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
16: 0x10065e4b8 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
17: 0x10065dfb4 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
18: 0x100d2b0cc Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
19: 0x100ca8758 Builtins_JSBuiltinsConstructStub [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
20: 0x100d91204 Builtins_ConstructHandler [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
21: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
22: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
23: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
24: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
25: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
26: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
27: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
28: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
29: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
30: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
31: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
32: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
33: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
34: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
35: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
36: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
37: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
38: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
39: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
40: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
41: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
42: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
43: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
44: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
45: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
46: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
47: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
48: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
49: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
50: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
51: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
52: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
53: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
54: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
55: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
56: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
57: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
58: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
59: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
60: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
61: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
62: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
63: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
64: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
65: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
66: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
67: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
68: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
69: 0x100cad520 Builtins_InterpreterEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
70: 0x100caa5a8 Builtins_JSEntryTrampoline [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
71: 0x100caa24c Builtins_JSEntry [/Users/rahulbharati/.nvm/versions/node/v12.20.1/bin/node]
72: 0x150008000 ```
Any help appreciated. Thanks.
Currently, node on M1 macOS doesn't work well except node@15. If you using node@12 built on arm64 architecture, it may be crashed on some scripts such as https://github.com/dcodeIO/long.js.git
You can check it if you run test cases in long.js repository.
If you would like to know on which your node is built, please follow this:
$ node
Welcome to Node.js v12.21.0.
Type ".help" for more information.
>
> process.arch
'arm64'
The above example means the node binary is built for arm64 architecture (Apple Silicon M1 chip). If node is run on rosetta2, it will display 'x64'.
I have tested some test cases in long.js and node.js source repository.
As I know, node@12 for arm64 works well for some scripts, but some scripts has been crashed such as long.js.
On June 21th, 2021, node@14 on Homebrew has passed long.js test cases for arm64. (v14.17.1) Of course, node@16 also supports it.
But, node@12 still has errors on them. (v12.22.1)
This issue has been fixed in Node 15.3.0.
I updated mine and it worked fine for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With