ERROR: Failure during analysis, Node.js command to start eslint-bridge was

SonarQube 7.9.4 LTS
SonarJS 6.2.2 (build 13315)
SonarTS 2.1 (build 4359)

I am seeing errors in logs during Javascript analysis, due to which findings on JS files are not being reported. This does not happen all the times, but does happen frequently. Checked other similar topics here but could not really find how to fix it. If memory allocation needs to be increased for this, where should it be - SonarQube process or nodejs/javascript process ? VM running the scan has 8 GB RAM.

Log attached:

07:30:48  ERROR: Failed to parse file [projnameBoard/Scripts/css3.js] at line 5: Unexpected token <
07:30:49  ERROR: 
07:30:49  ERROR: 
07:30:49  ERROR: #
07:30:49  ERROR: # Fatal error in , line 0
07:30:49  ERROR: # Fatal process out of memory: Zone
07:30:49  ERROR: #
07:30:49  ERROR: #
07:30:49  ERROR: #
07:30:49  ERROR: #FailureMessage Object: 00000072B61FA300FATAL ERROR: NewSpace::Rebalance Allocation failed - JavaScript heap out of memory
07:30:51  ERROR: Failed to get response while analyzing file:///D:/projname/projname/Source/projnameBoardSolution/projnameBoard/Scripts/jquery-3.2.1.js
07:30:51  java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:6687
07:30:51  	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:249)
07:30:51  	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:167)
07:30:51  	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
07:30:51  	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
07:30:51  	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
07:30:51  	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
07:30:51  	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
07:30:51  	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
07:30:51  	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
07:30:51  	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:264)
07:30:51  	at okhttp3.RealCall.execute(RealCall.java:93)
07:30:51  	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.request(EslintBridgeServerImpl.java:195)
07:30:51  	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.analyzeJavaScript(EslintBridgeServerImpl.java:180)
07:30:51  	at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.analyze(JavaScriptEslintBasedSensor.java:115)
07:30:51  	at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.runEslintAnalysis(JavaScriptEslintBasedSensor.java:94)
07:30:51  	at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.analyzeFiles(JavaScriptEslintBasedSensor.java:77)
07:30:51  	at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(AbstractEslintSensor.java:107)
07:30:51  	at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.execute(JavaScriptEslintBasedSensor.java:49)
07:30:51  	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
07:30:51  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
07:30:51  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
07:30:51  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
07:30:51  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
07:30:51  	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
07:30:51  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
07:30:51  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
07:30:51  	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:400)
07:30:51  	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395)
07:30:51  	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:392)
07:30:51  	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
07:30:51  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
07:30:51  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
07:30:51  	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
07:30:51  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
07:30:51  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
07:30:51  	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
07:30:51  	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
07:30:51  	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
07:30:51  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
07:30:51  	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
07:30:51  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
07:30:51  	at java.lang.reflect.Method.invoke(Unknown Source)
07:30:51  	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
07:30:51  	at com.sun.proxy.$Proxy0.execute(Unknown Source)
07:30:51  	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:185)
07:30:51  	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
07:30:51  	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
07:30:51  	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
07:30:51  	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
07:30:51  Caused by: java.net.ConnectException: Connection refused: connect
07:30:51  	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
07:30:51  	at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
07:30:51  	at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
07:30:51  	at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
07:30:51  	at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
07:30:51  	at java.net.PlainSocketImpl.connect(Unknown Source)
07:30:51  	at java.net.SocksSocketImpl.connect(Unknown Source)
07:30:51  	at java.net.Socket.connect(Unknown Source)
07:30:51  	at okhttp3.internal.platform.Platform.connectSocket(Platform.java:130)
07:30:51  	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:247)
07:30:51  	... 55 common frames omitted
07:30:51  
07:30:51  ERROR: Failure during analysis, Node.js command to start eslint-bridge was: node D:\projname\.sonarqube\out\.sonar\.sonartmp\eslint-bridge-bundle\package\bin\server 6687 127.0.0.1
07:30:51  java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:6687
07:30:51  	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:249)
07:30:51  	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:167)
07:30:51  	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
07:30:51  	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
07:30:51  	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
07:30:51  	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
07:30:51  	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
07:30:51  	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
07:30:51  	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
07:30:51  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
07:30:51  	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:264)
07:30:51  	at okhttp3.RealCall.execute(RealCall.java:93)
07:30:51  	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.request(EslintBridgeServerImpl.java:195)
07:30:51  	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.analyzeJavaScript(EslintBridgeServerImpl.java:180)
07:30:51  	at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.analyze(JavaScriptEslintBasedSensor.java:115)
07:30:51  	at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.runEslintAnalysis(JavaScriptEslintBasedSensor.java:94)
07:30:51  	at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.analyzeFiles(JavaScriptEslintBasedSensor.java:77)
07:30:51  	at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(AbstractEslintSensor.java:107)
07:30:51  	at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.execute(JavaScriptEslintBasedSensor.java:49)
07:30:51  	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
07:30:51  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
07:30:51  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
07:30:51  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
07:30:51  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
07:30:51  	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
07:30:51  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
07:30:51  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
07:30:51  	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:400)
07:30:51  	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395)
07:30:51  	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:392)
07:30:51  	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
07:30:51  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
07:30:51  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
07:30:51  	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
07:30:51  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
07:30:51  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
07:30:51  	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
07:30:51  	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
07:30:51  	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
07:30:51  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
07:30:51  	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
07:30:51  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
07:30:51  	at java.lang.reflect.Method.invoke(Unknown Source)
07:30:51  	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
07:30:51  	at com.sun.proxy.$Proxy0.execute(Unknown Source)
07:30:51  	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:185)
07:30:51  	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
07:30:51  	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
07:30:51  	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
07:30:51  	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
07:30:51  Caused by: java.net.ConnectException: Connection refused: connect
07:30:51  	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
07:30:51  	at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
07:30:51  	at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
07:30:51  	at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
07:30:51  	at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
07:30:51  	at java.net.PlainSocketImpl.connect(Unknown Source)
07:30:51  	at java.net.SocksSocketImpl.connect(Unknown Source)
07:30:51  	at java.net.Socket.connect(Unknown Source)
07:30:51  	at okhttp3.internal.platform.Platform.connectSocket(Platform.java:130)
07:30:51  	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:247)
07:30:51  	... 55 common frames omitted
07:30:51  
07:30:51  INFO: Sensor JavaScript analysis [javascript] (done) | time=13025ms

hello @ankurja ,

It seems that you are analyzing some JS libraries (jquery) from your project. This is not recommended, you should exclude the libraries from the analysis by setting sonar.exclusions property. See docs for details Narrowing the Focus | SonarQube Docs

Hi @saberduck , yes I had noticed it and excluded all such libraries from scan, but is that the reason for inability to start eslint-bridge ? it points towards insufficient memory.

Yes big libraries can cause analysis to become stuck. You can also increase the available memory for eslint-bridge process using the sonar.javascript.node.maxspace property.

Which Node.js version you have installed on the machine doing the analysis? Using latest LTS version (v14) can improve the performance.

There are also quite important improvements with the more recent version of JS analyzer. If possible you could consider upgrading to SonarQube 8.7.

Thanks @saberduck for further hints. Though I have not faced the problem again after excluding the external libraries, I will try increasing memory for eslint-bridge process in case I see the error again.

I am using Node.js version 12.7.

For upgrading SonarQube, I have been waiting for v8 LTS (on side note - 18 months LTS release policy for SonarQube seems too long to me. I wish it comes down so that companies who have policy to remain on LTS versions, can make use of new improvements/features. Waiting for 18 months is just too much.)