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.
Versions
14:00:21.996 INFO: SonarScanner 4.6.2.2472
14:00:21.997 INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
14:00:21.997 INFO: Linux 5.10.25-linuxkit amd64
Logs
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 127.0.0.1 /usr/src/.scannerwork true 39139 127.0.0.1 /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.
Cause
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.