Closed TisnKu closed 1 year ago
As I observe the resource monitor, in idle mode, wsl ubuntu consumes about 4GB ram. When loading typescript-tools in the repo, the ram consumption goes up to 12GB and then crashes. Is it because the tool is trying to parse the whole monorepo? Compare to that, VSCode does not need so much ram to load a project, there seems to be phased lsp loading and cache.
Similar things happened my m1 pro MBP as well, the node process memory increased to 4.5GB and crashed. If I trigger lsp definition seeking during loading of the tool, the crash process will happen much faster.
So I checked vscode and it constrains max memory of node running tsserver to 3072m. We probably need similar solution. I implement this later today.
Edit: related https://github.com/pmizio/typescript-tools.nvim/issues/48
@TisnKu can you take a look on connected pr it add memory limit similar how vscode do that. I also set default value same as in vscode.
@pmizio I tested the PR on windows with default config(aka 3072 memory), and have the following error. This time no error in lsp log.
Windows WSL2 Ubuntu test result:
LSP logs:
[START][2023-06-24 10:23:13] LSP logging initiated
[WARN][2023-06-24 10:23:13] ...lsp/handlers.lua:134 "The language server copilot triggers a registerCapability handler for workspace/didChangeWorkspaceFolders despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[WARN][2023-06-24 10:23:19] ...lsp/handlers.lua:134 "The language server eslint triggers a registerCapability handler for workspace/didChangeWorkspaceFolders despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[ERROR][2023-06-24 10:23:57] ...ools/process.lua:180 "process" "tsserver" "stderr" "\n<--- Last few GCs --->\n\n[2905:0x56594e0] 36513 ms: Mark-sweep 3036.4 (3106.3) -> 3022.5 (3108.0) MB, 617.4 / 0.5 ms (average mu = 0.134, current mu = 0.032) allocation failure scavenge might not succeed\n[2905:0x56594e0] 37163 ms: Mark-sweep 3038.5 (3108.3) -> 3024.5 (3110.3) MB, 631.2 / 0.5 ms (average mu = 0.084, current mu = 0.029) allocation failure scavenge might not succeed\n\n\n<--- JS stacktrace --->\n\nFATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory\n"
[ERROR][2023-06-24 10:23:57] ...ools/process.lua:180 "process" "tsserver" "stderr" " 1: 0xb090e0 node::Abort() [node]\n"
[ERROR][2023-06-24 10:23:57] ...ools/process.lua:180 "process" "tsserver" "stderr" " 2: 0xa1b70e [node]\n"
[ERROR][2023-06-24 10:23:57] ...ools/process.lua:180 "process" "tsserver" "stderr" " 3: 0xce19d0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]\n"
[ERROR][2023-06-24 10:23:57] ...ools/process.lua:180 "process" "tsserver" "stderr" " 4: 0xce1d77 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]\n"
[ERROR][2023-06-24 10:23:57] ...ools/process.lua:180 "process" "tsserver" "stderr" " 5: 0xe993e5 [node]\n"
[ERROR][2023-06-24 10:23:57] ...ools/process.lua:180 "process" "tsserver" "stderr" " 6: 0xe99ec6 [node]\n"
[ERROR][2023-06-24 10:23:57] ...ools/process.lua:180 "process" "tsserver" "stderr" " 7: 0xea83ee [node]\n"
[ERROR][2023-06-24 10:23:57] ...ools/process.lua:180 "process" "tsserver" "stderr" " 8: 0xea8e30 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]\n"
[ERROR][2023-06-24 10:23:57] ...ools/process.lua:180 "process" "tsserver" "stderr" " 9: 0xeabdae v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]\n"
[ERROR][2023-06-24 10:23:57] ...ools/process.lua:180 "process" "tsserver" "stderr" "10: 0xe6d2ea v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]\n"
[ERROR][2023-06-24 10:23:57] ...ools/process.lua:180 "process" "tsserver" "stderr" "11: 0x11e6196 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]\n"
[ERROR][2023-06-24 10:23:57] ...ools/process.lua:180 "process" "tsserver" "stderr" "12: 0x15d9e19 [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" "\n<--- Last few GCs --->\n\n[2904:0x67dc4e0] 36999 ms: Mark-sweep 3037.2 (3107.0) -> 3023.4 (3109.3) MB, 595.9 / 0.4 ms (average mu = 0.136, current mu = 0.032) allocation failure scavenge might not succeed\n[2904:0x67dc4e0] 37642 ms: Mark-sweep 3039.2 (3109.3) -> 3025.9 (3111.5) MB, 619.5 / 0.8 ms (average mu = 0.088, current mu = 0.037) allocation failure scavenge might not succeed\n\n\n<--- JS stacktrace --->\n\nFATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" " 1: 0xb090e0 node::Abort() [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" " 2: 0xa1b70e [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" " 3: 0xce19d0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" " 4: 0xce1d77 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" " 5: 0xe993e5 [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" " 6: 0xe99ec6 [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" " 7: 0xea83ee [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" " 8: 0xea8e30 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" " 9: 0xeabdae v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" "10: 0xe6d022 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" "11: 0xe65634 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Map, v8::internal::AllocationAlignment) [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" "12: 0xe67340 v8::internal::FactoryBase<v8::internal::Factory>::NewRawOneByteString(int, v8::internal::AllocationType) [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" "13: 0x10f87e8 v8::internal::String::SlowFlatten(v8::internal::Isolate*, v8::internal::Handle<v8::internal::ConsString>, v8::internal::AllocationType) [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" "14: 0x10fa06d v8::internal::String::LastIndexOf(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" "15: 0xd6937c v8::internal::Builtin_StringPrototypeLastIndexOf(int, unsigned long*, v8::internal::Isolate*) [node]\n"
[ERROR][2023-06-24 10:23:58] ...ools/process.lua:180 "process" "tsserver" "stderr" "16: 0x15d9ef9 [node]\n"
Mac test result is the same with WSL2.
LSP logs:
[START][2023-06-24 10:23:30] LSP logging initiated
[WARN][2023-06-24 10:23:30] ...lsp/handlers.lua:137 "The language server copilot triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[WARN][2023-06-24 10:23:34] ...lsp/handlers.lua:137 "The language server eslint triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[WARN][2023-06-24 10:23:38] ...lsp/handlers.lua:137 "The language server eslint triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "\n<--- Last few GCs --->\n\n[68430:0x150008000] 61934 ms: Mark-sweep 3042.7 (3114.6) -> 3029.8 (3117.6) MB, 2637.3 / 0.1 ms (average mu = 0.342, current mu = 0.044) allocation failure scavenge might not succeed\n[68430:0x150008000] 67172 ms: Mark-sweep 3045.8 (3117.6) -> 3036.7 (3124.6) MB, 5070.0 / 0.1 ms (average mu = 0.150, current mu = 0.032) allocation failure scavenge might not succeed\n\n\n<--- JS stacktrace --->\n\nFATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" " 1: 0x10069d260 node::Abort() [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n 2: 0x10069d3e8 node::errors::TryCatchScope::~TryCatchScope() [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n 3: 0x1007ebed0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" " 4: 0x1007ebe64 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n 5: 0x10096f57c v8::internal::Heap::GarbageCollectionReasonToString(v8::internal::GarbageCollectionReason) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" " 6: 0x10096e09c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n 7: 0x1009793e4 v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" " 8: 0x100979478 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" " 9: 0x10094c30c v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "10: 0x100c84410 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "11: 0x100f98a8c Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n12: 0x10501f43c \n13: 0x10505acdc \n14: 0x105575eb0 \n15: 0x10509fbf8 \n16: 0x10506f06c \n17: 0x107922eec \n18: 0x107922ff8 \n19: 0x10556134c \n20: 0x1052a6edc \n21: 0x109cda9fc \n22: 0x1051986a0 \n23: 0x10523b928 \n24: 0x105ac8d00 \n25: 0x10526e9f0 \n26: 0x10521e5cc \n27: 0x105af0454 \n28: 0x10520e570 \n29: 0x10c9afbe4 \n30: 0x105265640 \n31: 0x10c9b1dd0 \n32: 0x10523601c \n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "33: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n34: 0x1051e3178 \n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "35: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "36: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "37: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "38: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "39: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "40: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "41: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "42: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "43: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "44: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "45: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "46: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "47: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "48: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "49: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "50: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "51: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "52: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "53: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "54: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "55: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "56: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "57: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "58: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "59: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "60: 0x100f2c718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "61: 0x100f2a50c Builtins_JSEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "62: 0x100f2a1a4 Builtins_JSEntry [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "63: 0x1008fbd64 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "64: 0x1008fb3f8 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "65: 0x100808888 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "66: 0x1005ea3a0 node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "67: 0x1005ff4c0 node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "68: 0x100743ff4 node::StreamBase::CallJSOnreadMethod(long, v8::Local<v8::ArrayBuffer>, unsigned long, node::StreamBase::StreamBaseJSChecks) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "69: 0x100745fc0 node::EmitToJSStreamListener::OnStreamRead(long, uv_buf_t const&) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "70: 0x10074a5e0 node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "71: 0x100f17e84 uv__stream_io [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "72: 0x100f1ffb8 uv__io_poll [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "73: 0x100f0e6d0 uv_run [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "74: 0x1005eaccc node::SpinEventLoop(node::Environment*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "75: 0x1006d65b0 node::NodeMainInstance::Run(int*, node::Environment*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "76: 0x1006d627c node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "77: 0x10066f080 node::Start(int, char**) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:41] ...ools/process.lua:180 "process" "tsserver" "stderr" "78: 0x18e58ff28 start [/usr/lib/dyld]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "\n<--- Last few GCs --->\n\n[68427:0x128008000] 65134 ms: Mark-sweep 3036.2 (3107.9) -> 3020.7 (3108.4) MB, 2413.6 / 0.1 ms (average mu = 0.100, current mu = 0.023) allocation failure scavenge might not succeed\n[68427:0x128008000] 66550 ms: Mark-sweep 3036.7 (3108.4) -> 3021.3 (3108.9) MB, 1378.1 / 0.1 ms (average mu = 0.075, current mu = 0.027) allocation failure scavenge might not succeed\n\n\n<--- JS stacktrace --->\n\nFATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" " 1: 0x104589260 node::Abort() [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" " 2: 0x1045893e8 node::errors::TryCatchScope::~TryCatchScope() [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" " 3: 0x1046d7ed0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" " 4: 0x1046d7e64 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" " 5: 0x10485b57c v8::internal::Heap::GarbageCollectionReasonToString(v8::internal::GarbageCollectionReason) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" " 6: 0x10485eb8c v8::internal::Heap::CollectSharedGarbage(v8::internal::GarbageCollectionReason) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" " 7: 0x10485bd44 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" " 8: 0x10485966c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" " 9: 0x1048653e4 v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "10: 0x104865478 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "11: 0x10483830c v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "12: 0x104b70410 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "13: 0x104e84a8c Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n14: 0x108ee1f14 \n15: 0x109165638 \n16: 0x109422c1c \n17: 0x10d3f2768 \n18: 0x10b05fed4 \n19: 0x109475c5c \n20: 0x10919fe28 \n21: 0x108fce7d0 \n22: 0x109152594 \n23: 0x1091ef31c \n24: 0x109422c1c \n25: 0x10b078f34 \n26: 0x1091ae438 \n27: 0x10b060264 \n28: 0x109475c5c \n29: 0x10919fe28 \n30: 0x108fce7d0 \n31: 0x109152594 \n32: 0x109152910 \n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "33: 0x108ee3964 \n34: 0x108eebab8 \n35: 0x10b3343ec \n36: 0x110257f88 \n37: 0x108ff6518 \n38: 0x1091515dc \n39: 0x1091523a4 \n40: 0x1091ef31c \n41: 0x109422c1c \n42: 0x10b078f34 \n43: 0x1091ae438 \n44: 0x10b060264 \n45: 0x109475c5c \n46: 0x10919fe28 \n47: 0x108fce7d0 \n48: 0x109152594 \n49: 0x108ee3964 \n50: 0x108eebab8 \n51: 0x10b3343ec \n52: 0x110257f88 \n53: 0x108ff6518 \n54: 0x1091515dc \n55: 0x1091523a4 \n56: 0x1091ef31c \n57: 0x109422c1c \n58: 0x10b078f34 \n59: 0x1091ae438 \n60: 0x10b060264 \n61: 0x109475c5c \n62: 0x10919fe28 \n63: 0x108fce7d0 \n64: 0x109152594 \n65: 0x108ee3964 \n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "66: 0x108eebab8 \n67: 0x10b3343ec \n68: 0x110257f88 \n69: 0x108ff6518 \n70: 0x1091515dc \n71: 0x1091523a4 \n72: 0x1091ef31c \n73: 0x109422c1c \n74: 0x10b078f34 \n75: 0x1091ae438 \n76: 0x10b060264 \n77: 0x109475c5c \n78: 0x10919fe28 \n79: 0x108fce7d0 \n80: 0x109152594 \n81: 0x108ee3964 \n82: 0x108eebab8 \n83: 0x10b3343ec \n84: 0x1094282cc \n85: 0x109199248 \n86: 0x10b060fc0 \n87: 0x10943a1cc \n88: 0x108f5f23c \n89: 0x109329670 \n90: 0x110255b08 \n91: 0x10d3e8428 \n92: 0x110258ef0 \n93: 0x1091e96a4 \n94: 0x108f191e0 \n95: 0x1091e9a70 \n96: 0x11024fa3c \n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "97: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n98: 0x108fd4578 \n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "99: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "100: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "101: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "102: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "103: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "104: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "105: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "106: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "107: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "108: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "109: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "110: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "111: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "112: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "113: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "114: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "115: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "116: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "117: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "118: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "119: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "120: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "121: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "122: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "123: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "124: 0x104e18718 Builtins_InterpreterEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "125: 0x104e1650c Builtins_JSEntryTrampoline [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "126: 0x104e161a4 Builtins_JSEntry [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "127: 0x1047e7d64 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "128: 0x1047e73f8 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "129: 0x1046f4888 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "130: 0x1044d63a0 node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "131: 0x1044eb4c0 node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "132: 0x10462fff4 node::StreamBase::CallJSOnreadMethod(long, v8::Local<v8::ArrayBuffer>, unsigned long, node::StreamBase::StreamBaseJSChecks) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "133: 0x104631fc0 node::EmitToJSStreamListener::OnStreamRead(long, uv_buf_t const&) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "134: 0x1046365e0 node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "135: 0x104e03e84 uv__stream_io [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "136: 0x104e0bfb8 uv__io_poll [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "137: 0x104dfa6d0 uv_run [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "138: 0x1044d6ccc node::SpinEventLoop(node::Environment*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "139: 0x1045c25b0 node::NodeMainInstance::Run(int*, node::Environment*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "140: 0x1045c227c node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n"
[ERROR][2023-06-24 10:24:42] ...ools/process.lua:180 "process" "tsserver" "stderr" "141: 0x10455b080 node::Start(int, char**) [/Users/txku/.nodenv/versions/16.14.2/bin/node]\n142: 0x18e58ff28 start [/usr/lib/dyld]\n"
@TisnKu Ok, I was able to replicate this using WindowsVM and I have good news: In pr you tested today I added fix to windows specyfic issue which crashed I/O communication so you should be able to run this on Windows without WSL. I also simulated out of memory error by reducing ram in vm and it is complicated one because it isn't exacty on side of plugin. We run servers and memory allocation and so on are done by tsserver itself. But there are some variables you can poke to tweak this:
tsserver_max_memory
- it is in MB, this is tricky one because you can limit too much and tsserver never start up, there is no good answer how to set good value probably one method is test and bleeding. IMPORTANT: this value is accually doubled because we run 2 servers by defaultseparate_diagnostic_server
- set to false, this cut by half memory usage because plugin will use only one serverroot_dir
- maybe you can set more specyfic root_dir to trim down scope of workspace for tsserver and by it count of files to indexBesides this 3 purely individual points I don't think I can do something on plugin side because tsserver fails after lauch.
@pmizio I tried the latest PR on windows and increased memory to 8192MB, it now works like charm! Big thanks.
BTW, I checked the vscode settings of my monorepo, and found the tsserver memory threshold set to 12GB, I always thought it was 4GB 😄
Nice, I changed default value to "no limit" it is probably ok for most of peope. For them who need fine grainded control they just can use introduced config variable.
@TisnKu Is this solution sufficient to close this issue?
Environment: Windows 10 WSL2 Ubuntu I opened a large monorepo and navigated to a tsx file. Then typescript-tools started loading, after some time, it crashed.
Typescript-tools loading:
Crash message:
LSPLogs: