Sonar analysis JS file timeout problem location?

1.Recently, we used sonar scanning project to check the code. We found that some JS files could not be scanned and timed out. The specific errors are as follows:

The scanning environment information is as follows:
What is the cause of the overtime problem?

Hi @baiguanghui,

A few things to try (in this order):

  1. Please upgrade your SonarJS plugin to 6.2.2 and try rescanning.
  2. Please allocate more memory for the Node process as explained in Troubleshooting: Slow or Unresponsive Analysis:

    You can use sonar.javascript.node.maxspace property to allow the analysis to use more memory. Set this property to 4096 or 8192 for big projects. This property should be set in file or on command line for scanner (with -Dsonar.javascript.node.maxspace=4096 ).

  3. Upgrade your Node.js version to 14. If that is too difficult, try Node.js 12.
  4. Allocate more memory to your build/container agent, if you are in a build or containerization environment.


Hi joe
I just put node.js Upgrade to version 12, then i can scan normally, but my project needs to use node.js 10,How to break through this bottleneck?
In urgent need of help

Did you do suggestions #1 and #2?

I didn’t do the first step and the second step. I had two virtual machines and one was installed node.js 12, The JS file can be scanned normally; another one is installed node.js10, When scanning JS, the error in the figure above will appear. I tried to use - Dsonar.javascript.node . maxspace = 4096 to scan, but it doesn’t seem to take effect. To make this parameter take effect, do I need to upgrade the version of sonarjs? I’m currently using sonar-javascript-plugin-

Do step 1 and 2. The maxspace parameter is applicable to either your old or new JS plugin for SonarQube. Try using 8192 value.

OK, I’ll tell you the result later.

I suddenly found out, node.js no problem.Is there something wrong with eslint based.

ESLint-based SonarJS is based on Node.js, so it can still be an issue with that one file. What was the result of your testing with upgrading SonarJS, and sonar.javascript.node.maxspace=8192? What issues are you having when upgrading to Node.js 12?

  1. If node.js With version 12, JS files can be executed successfully directly.

  2. After I use sonar-javascript-, sonar can’t recognize JS plug-in. The sonar version I use is 7.9.3, which doesn’t support 6.2.2 sonarJS Is that right?

SonarQube 7.9.3 support SonarJS 6.2.2. See Plugin Version Matrix. Please check your log files for SonarQube for the error or please post the logs here with the error you are getting.

Now that I have upgraded the sonarts version to 2.1, the sonarjs plug-in can be recognized normally.

About- Dsonar.javascript.node.Maxspace. I have set the parameter five times, the first time- Dsonar.javascript.node . maxspace = 4096, indicating insufficient memory; second time- Dsonar.javascript.node . maxspace = 8192, the execution is successful; the third time- Dsonar.javascript.node . maxspace = 4096, indicating insufficient memory; the fourth time- Dsonar.javascript.node . maxspace = 8192 Indicates that there is not enough memory; the fifth time- Dsonar.javascript.node .maxspace=10240,or not enough memory.
The specific errors are as follows:

Why did i just start- Dsonar.javascript.node.maxspace = 8192 all succeeded, later- Dsonar.javascript.node.maxspace = 8192 fails, even -Dsonar.javascript.node.maxspace = 10240 also failed.
I’m a little worried

It seems 8192 is a better setting but still not consistent in result. I believe upgrading your Node.js version to 12 or 14: this will be your best way to prevent the nondeterministic failure.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.