question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support specify --max-old-space-size for started server

See original GitHub issue

When I use eslint plugin in VSCode to lint a large bunch of files, the eslint server crashes. I try to find some way to add node options like “–max-old-space-size=4096”, “–stack_size=10000” to start eslint server but failed.

crash message

[Info  - 5:28:05 PM] ESLint server stopped.
[Info  - 5:28:06 PM] ESLint server running in node v10.11.0
[Info  - 5:28:06 PM] ESLint server is running.
[Info  - 5:28:07 PM] ESLint library loaded from: /Users/dddong/workspace/JS2FuzzIL/node_modules/eslint/lib/api.js
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x10ae379d5 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 2: 0x10ae37b4a node::get_builtin_module(char const*) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 3: 0x1077e2c6e v8::internal::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 4: 0x1078a3fc2 v8::internal::Heap::CreateFillerObjectAt(unsigned long, int, v8::internal::ClearRecordedSlots, v8::internal::ClearFreedMemoryMode) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 5: 0x1078a6703 v8::internal::Heap::CreateFillerObjectAt(unsigned long, int, v8::internal::ClearRecordedSlots, v8::internal::ClearFreedMemoryMode) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 6: 0x1078a272c v8::internal::Heap::CreateFillerObjectAt(unsigned long, int, v8::internal::ClearRecordedSlots, v8::internal::ClearFreedMemoryMode) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 7: 0x1078a0561 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 8: 0x1078acc75 v8::internal::Heap::RootIsImmortalImmovable(int) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 9: 0x1078accdf v8::internal::Heap::RootIsImmortalImmovable(int) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
10: 0x107449a73 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
11: 0x107625f8c v8::internal::RegisterConfiguration::AreAliases(v8::internal::MachineRepresentation, int, v8::internal::MachineRepresentation, int) const [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
12: 0x107a81d8e v8::internal::Parser::BuildIteratorCloseForCompletion(v8::internal::ZoneList<v8::internal::Statement*>*, v8::internal::Variable*, v8::internal::Expression*, v8::internal::IteratorType) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]

<--- Last few GCs --->

[51895:0x10c8a7000]   785803 ms: Mark-sweep 2049.1 (2086.5) -> 2048.4 (2087.5) MB, 2049.2 / 0.0 ms  (average mu = 0.073, current mu = 0.007) allocation failure scavenge might not succeed


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x107a81d8e]
Security context: 0x039f533676d9 <JSObject>
    1: /* anonymous */ [0x39f4467e3e1] [/Users/dddong/workspace/JS2FuzzIL/node_modules/acorn/dist/acorn.js:~4254] [pc=0x25db0d97b8c0](this=0x039f90bd4d69 <Parser map = 0x39fd3860a81>)
    2: /* anonymous */ [0x39f4467c2e1] [/Users/dddong/workspace/JS2FuzzIL/node_modules/acorn/dist/acorn.js:~2728] [pc=0x25db0d875615](this=0x039f90bd4d69 <Parser map = 0x39fd3860a...

Eslint version: 1.9.0 Vscode version: 1.37.0-insider

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:27 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
bradleyayerscommented, Jan 12, 2020

I’ve ended up using the eslint.runtime option for this, with the script:

#!/bin/bash

echo "ESLint server using Node.js from: $0"
export NODE_OPTIONS=--max_old_space_size=4096
echo "ESLint server using NODE_OPTIONS: $NODE_OPTIONS"
node $@

2reactions
maneetgoyalcommented, Mar 4, 2020

I’ve ended up using the eslint.runtime option for this, with the script:

#!/bin/bash

echo "ESLint server using Node.js from: $0"
export NODE_OPTIONS=--max_old_space_size=4096
echo "ESLint server using NODE_OPTIONS: $NODE_OPTIONS"
node $@

@bradleyayers @singleghost Can you please add some more details? I think I’m doing something wrong. Currently, I have this in my settings.json: "eslint.runtime": "./vscode-eslint.sh", and vscode-eslint.sh contains the code you suggested. Getting the following error:

Screen Shot 2020-03-03 at 6 34 21 PM

Using absolute path for the bash script seemed to work, after chmod.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I determine the correct "max-old-space-size" for node ...
This error occurs when the memory allocated for the executing application is less than the required memory. By default, the memory limit in...
Read more >
How Can I Increase the Max Memory for Node?
It's possible to adjust the max memory ceiling using a command-line flag passed into Node: --max-old-space-size=<memory in MB> ...
Read more >
Node.js Default Memory Settings | by Hon Nam | Geek Culture
If you are running a simple web server using Node.js on a small machine e.g. Raspberry Pi board, you can set the --max-old-space-size...
Read more >
node_options=--max_old_space_size=16384 - You.com
The NODE_OPTIONS --max-old-space-size environment variable allows to increase Node's max heap size. Setting an environmental variable allows Node to read ...
Read more >
JavaScript heap out of memory - how to increase the max ...
If you want to increase the max memory for Node you can use --max_old_space_size option. You should set this with NODE_OPTIONS environment variable....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found