ESLint bridge server restarts fail due to missing script argument resets

Hey folks,

the ESLint bridge runs into a bug whenever it is supposed to be restarted the log output nicely shows this and it is easily identifiable via the source code as well.


14:00:21.996 INFO: SonarScanner
14:00:21.997 INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
14:00:21.997 INFO: Linux 5.10.25-linuxkit amd64


14:08:04.672 DEBUG: Starting Node.js process to start eslint-bridge server at port 39139
14:08:04.673 DEBUG: Launching command node --max-old-space-size=8192 --max-old-space-size=8192 /usr/src/.scannerwork/.sonartmp/eslint-bridge-bundle/package/bin/server 37023 /usr/src/.scannerwork true  39139 /usr/src/.scannerwork true
14:08:11.554 DEBUG: starting eslint-bridge server at port 37023
14:08:11.673 DEBUG: eslint-bridge server is running at port 37023
14:13:04.771 ERROR: Failed to start server (300s timeout)
org.sonarsource.nodejs.NodeCommandException: Failed to start server (300s timeout)

Note that the script arguments are passed twice to the Node.js process. Also the expected and actual ports do not match as a result of that. As a consequence, the Node.js analysis process fails.


The corresponding source code of EslintBridgeServerImpl shows why this is the case: nodeCommandBuilder is reused across executions. As a consequence, scriptArgs is not cleared, but instead always appended to

There is no workaround right now. Analysis always fails.

1 Like

I have provided a fix for this bug via the following PR: EslintBridgeServer restarts always fail by bripkens · Pull Request #2723 · SonarSource/SonarJS · GitHub

1 Like

Thank for the PR, eventually we did the fix in another manner (Do not try to restart Node process if it's not answering by vilchik-elena · Pull Request #2748 · SonarSource/SonarJS).

What is more interesting is that why Node process fails in the first place. Could you provide any details of this?

1 Like