Eslint-bridge server running out of memory

Using sonarlint in VSCode is failing for large Typescript problems, it seems that the nodejs process for eslint-bridge is default set to 2GB which is not enough. Trying to adjust the memory setting via “sonarlint.ls.vmargs”: “-Xmx8096m -Dsonar.javascript.node.maxspace=8096”, is not helping.

[Debug - 13:49:43.712] Plugins:
[Debug - 13:49:43.713]   * Python Code Quality and Security 3.4.1.8066 (python)
[Debug - 13:49:43.713]   * Java Code Quality and Security 6.15.1.26025 (java)
[Debug - 13:49:43.713]   * HTML Code Quality and Security 3.4.0.2754 (web)
[Debug - 13:49:43.713]   * PHP Code Quality and Security 3.17.0.7439 (php)
[Debug - 13:49:43.714]   * SAP Screen Personas Custom JS Rules 1.0.0 (personas)
[Debug - 13:49:43.714]   * Sonar Secrets Plugin for SonarQube 1.1.0.36766 (secrets)
[Debug - 13:49:43.714]   * JavaScript/TypeScript Code Quality and Security 7.4.4.15624 (javascript)
[Info  - 13:50:29.825] Analyzing 1 files using tsconfig: /Users/redacted/Documents/git/redacted/tsconfig.json
[Info  - 13:50:29.825] 1 source file to be analyzed
[Debug - 13:50:38.934] GET 200 https://someurl/sonar/api/developers/search_events?projects=someproject&from=2022-01-13T13%3A50%3A38%2B0100 | response time=29ms
[Info  - 13:50:39.830] 0/1 files analyzed, current file: [uri=file:///Users/redacted/Documents/git/redacted/service/someFile.ts]
[Info  - 13:50:49.835] 0/1 files analyzed, current file: [uri=file:///Users/redacted/Documents/git/redacted/service/someFile.ts]
[Info  - 13:50:59.841] 0/1 files analyzed, current file: [uri=file:///Users/redacted/Documents/git/redacted/service/someFile.ts]
[Info  - 13:51:09.844] 0/1 files analyzed, current file: [uri=file:///Users/redacted/Documents/git/redacted/service/someFile.ts]
[Info  - 13:51:13.614] 
[Error - 13:51:13.615] FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
[Info  - 13:51:13.615] <--- Last few GCs --->
[Info  - 13:51:13.615] oc[58324:0x108008000]    53066 ms: Mark-sweep 2048.9 (2053.4) -> 2046.5 (2052.4) MB, 728.0 / 0.0 ms  (+ 92.3 ms in 18 steps since start of marking, biggest step 11.8 ms, walltime since start of marking 831 ms) (average mu = 0.157, current mu = 0.013) alloca[58324:0x108008000]    54260 ms: Mark-sweep 2048.0 (2052.6) -> 2047.5 (2052.9) MB, 1077.1 / 0.0 ms  (+ 101.2 ms in 21 steps since start of marking, biggest step 10.2 ms, walltime since start of marking 1194 ms) (average mu = 0.076, current mu = 0.013) all
[Info  - 13:51:13.615] 
[Error - 13:51:13.615]  1: 0x101203f65 node::Abort() (.cold.1) [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Info  - 13:51:13.615] <--- JS stacktrace --->
[Info  - 13:51:13.615] 
[Info  - 13:51:13.615] ==== JS stack trace =========================================
[Info  - 13:51:13.615] 
[Info  - 13:51:13.615]     0: ExitFrame [pc: 0x100a0ca19]
[Info  - 13:51:13.615] Security context: 0x3ccbfb3808d1 <JSObject>
[Info  - 13:51:13.615]     1: createCallExpression [0x3ccbe140ee19] [/Users/redacted/.sonarlint/work/.sonartmp_7617034217741662940/eslint-bridge-bundle/package/node_modules/typescript/lib/typescript.js:~22456] [pc=0xa65eb8dfdb8](this=0x3ccbe140d681 <Object map = 0x3ccb8e8acda9>,0x3ccbdab6ef91 <NodeObject map = 0x3ccb5d4b08b9>,0x3ccb810404b1 <undefined>,0x3ccbdab6f159 <JSArray[1]>)
[Info  - 13:51:13.615]    ...
[Info  - 13:51:13.615] 
[Error - 13:51:13.615]  2: 0x1000a5a09 node::Abort() [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Error - 13:51:13.616]  3: 0x1000a5b6f node::OnFatalError(char const*, char const*) [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Error - 13:51:13.616]  4: 0x1001eeb47 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Error - 13:51:13.616]  5: 0x1001eeae7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Error - 13:51:13.617]  6: 0x100387b05 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Error - 13:51:13.617]  7: 0x10038937a v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Error - 13:51:13.617]  8: 0x100385dac v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Error - 13:51:13.618]  9: 0x100383bae v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Error - 13:51:13.618] 10: 0x10038fa7a v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Error - 13:51:13.619] 11: 0x10038fb01 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Error - 13:51:13.619] 12: 0x10035d3da v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Error - 13:51:13.619] 13: 0x1006aff28 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Error - 13:51:13.620] 14: 0x100a0ca19 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/Cellar/nvm/0.38.0/versions/node/v12.21.0/bin/node]
[Error - 13:51:13.620] 15: 0xa65eb8dfdb8 
[Error - 13:51:13.849] Failed to get response while analyzing [uri=file:///Users/redacted/Documents/git/redacted/service/someFile.ts]
[Error - 13:51:13.850] java.net.ConnectException: Failed to connect to /127.0.0.1:61043
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:249)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:167)
	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:264)
	at okhttp3.RealCall.execute(RealCall.java:93)
	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.request(EslintBridgeServerImpl.java:226)
	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.analyzeTypeScript(EslintBridgeServerImpl.java:217)
	at org.sonar.plugins.javascript.eslint.TypeScriptSensor.analyze(TypeScriptSensor.java:157)
	at org.sonar.plugins.javascript.eslint.TypeScriptSensor.analyzeFilesWithTsConfig(TypeScriptSensor.java:145)
	at org.sonar.plugins.javascript.eslint.TypeScriptSensor.analyzeFiles(TypeScriptSensor.java:126)
	at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(AbstractEslintSensor.java:125)
	at org.sonar.plugins.javascript.eslint.TypeScriptSensor.execute(TypeScriptSensor.java:56)
	at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:80)
	at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.execute(SensorsExecutor.java:71)
	at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:133)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:126)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(ComponentContainer.java:111)
	at org.sonarsource.sonarlint.core.container.storage.StorageAnalyzer.analyze(StorageAnalyzer.java:77)
	at org.sonarsource.sonarlint.core.container.storage.StorageContainerHandler.analyze(StorageContainerHandler.java:80)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$analyze$0(ConnectedSonarLintEngineImpl.java:159)
	at org.sonarsource.sonarlint.core.AbstractSonarLintEngine.withModule(AbstractSonarLintEngine.java:87)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$analyze$1(ConnectedSonarLintEngineImpl.java:157)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:371)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:361)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.analyze(ConnectedSonarLintEngineImpl.java:155)
	at org.sonarsource.sonarlint.ls.AnalysisManager.lambda$analyzeConnected$15(AnalysisManager.java:509)
	at org.sonarsource.sonarlint.ls.AnalysisManager.analyzeWithTiming(AnalysisManager.java:537)
	at org.sonarsource.sonarlint.ls.AnalysisManager.analyzeConnected(AnalysisManager.java:509)
	at org.sonarsource.sonarlint.ls.AnalysisManager.analyze(AnalysisManager.java:348)
	at org.sonarsource.sonarlint.ls.AnalysisManager.lambda$analyzeAsync$4(AnalysisManager.java:295)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.base/java.net.Socket.connect(Socket.java:609)
	at okhttp3.internal.platform.Platform.connectSocket(Platform.java:130)
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:247)
	... 45 more

[Error - 13:51:13.850] Failure during analysis, Node.js command to start eslint-bridge was: /usr/local/opt/nvm/versions/node/v12.21.0/bin/node /Users/redacted/.sonarlint/work/.sonartmp_7617034217741662940/eslint-bridge-bundle/package/bin/server 61043 127.0.0.1 /Users/redacted/Documents/git/redacted true true 
[Error - 13:51:13.850] java.net.ConnectException: Failed to connect to /127.0.0.1:61043
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:249)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:167)
	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:264)
	at okhttp3.RealCall.execute(RealCall.java:93)
	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.request(EslintBridgeServerImpl.java:226)
	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.analyzeTypeScript(EslintBridgeServerImpl.java:217)
	at org.sonar.plugins.javascript.eslint.TypeScriptSensor.analyze(TypeScriptSensor.java:157)
	at org.sonar.plugins.javascript.eslint.TypeScriptSensor.analyzeFilesWithTsConfig(TypeScriptSensor.java:145)
	at org.sonar.plugins.javascript.eslint.TypeScriptSensor.analyzeFiles(TypeScriptSensor.java:126)
	at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(AbstractEslintSensor.java:125)
	at org.sonar.plugins.javascript.eslint.TypeScriptSensor.execute(TypeScriptSensor.java:56)
	at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:80)
	at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.execute(SensorsExecutor.java:71)
	at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:133)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:126)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(ComponentContainer.java:111)
	at org.sonarsource.sonarlint.core.container.storage.StorageAnalyzer.analyze(StorageAnalyzer.java:77)
	at org.sonarsource.sonarlint.core.container.storage.StorageContainerHandler.analyze(StorageContainerHandler.java:80)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$analyze$0(ConnectedSonarLintEngineImpl.java:159)
	at org.sonarsource.sonarlint.core.AbstractSonarLintEngine.withModule(AbstractSonarLintEngine.java:87)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$analyze$1(ConnectedSonarLintEngineImpl.java:157)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:371)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:361)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.analyze(ConnectedSonarLintEngineImpl.java:155)
	at org.sonarsource.sonarlint.ls.AnalysisManager.lambda$analyzeConnected$15(AnalysisManager.java:509)
	at org.sonarsource.sonarlint.ls.AnalysisManager.analyzeWithTiming(AnalysisManager.java:537)
	at org.sonarsource.sonarlint.ls.AnalysisManager.analyzeConnected(AnalysisManager.java:509)
	at org.sonarsource.sonarlint.ls.AnalysisManager.analyze(AnalysisManager.java:348)
	at org.sonarsource.sonarlint.ls.AnalysisManager.lambda$analyzeAsync$4(AnalysisManager.java:295)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.base/java.net.Socket.connect(Socket.java:609)
	at okhttp3.internal.platform.Platform.connectSocket(Platform.java:130)
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:247)
	... 45 more