SonarLint starts many background tasks (+50) on Reload Maven

  • Operating system: Windows 11
  • SonarLint plugin version: 10.6.1.78652
  • Programming language you’re coding in: Java
  • Is connected mode used: Yes
    • Connected to SonarQube (and which version): 10.3.0.82913
  • IntelliJ version: 241.15989.150

Description of the problem / question:
Whenever I start IntelliJ, SonarLint might start a few background tasks to scan my files, but it finishes fairly quickly. However, if I press the “Reload All Maven Projects” button, Sonar Lint starts 51 background tasks. All of them duplicates (see screenshot below).
They usually complete (or timeout) within 2-3 minutes, however if I within that time press the button again, it starts another 51.

Is this normal? Why does it need to many background tasks?

Hello @jaf, thank you for your report!

We take this kind of behavior very seriously, as one of our priorities is to not disturb the developer experience in the IDE. I am investigating the case and will get back to you as soon as possible.

I was able to reproduce the issue and find the root cause, so I created this ticket on our side.

This issue has been present since version 10.5; we will fix it for our next version, 10.7.

Usually, even if many analyses are triggered, they should be finished relatively quickly. There may be another issue on your side that prevents the analysis from finishing.

Could you please enable the logs and see if you notice any errors? Do you experience any issues when analyzing single files?

The log window runs out of space, so I can’t see all of it at once.

The only warning I can find is (it appears more than 51 times, my guess would be 2x51 times, but I cannot be certain):
WARN sonarlint - No workDir in SonarLint
And there are no errors.

It doesn’t look like it takes a long time to run a scan. It’s just that it does so 50 times in a row. I cannot see any obvious difference between the runs. The configuration printed after the following line is identical.

[SonarLint Server RPC request executor] INFO sonarlint - Triggering analysis with configuration:

It looks like it starts all the tasks in parallel, but since they print their log in order it seems like they are not fully parallelized.

It lists runtimes in the log so the following line appears 51 times:
INFO sonarlint - Analysis detected 15 issues and 0 Security Hotspots in [XXXX]ms
They start at about 7 seconds runtime and increase each time the line appears, it ends up at about 59 seconds runtime.

There is a huge jump two of the runs. Where it suddenly spends 20 seconds for a single run. But this might just be a hiccup, since it spend all of the time on one file. I’ve added the lines I found interesting below:

INFO sonarlint - Analysis detected 15 issues and 0 Security Hotspots in 7561ms
...
INFO sonarlint - Analysis detected 15 issues and 0 Security Hotspots in 21765ms
INFO sonarlint - Slowest analyzed files:    [uri=file://C:/Projects/[...].java] (21697ms, 30394B)
INFO sonarlint - Analysis detected 15 issues and 0 Security Hotspots in 43822ms
...
INFO sonarlint - Analysis detected 15 issues and 0 Security Hotspots in 59503ms

We just released SonarLint version 10.6.2.
Could you please update your SonarLint to this version and see if the issue is still happening? Thank you!

Looks like it is solved.

Now that the log is shorter, I can see that the x51 I experience is due to the size of of my project and the number of modules/directories I have open and compile.

So the logs still start x51 times, but now it’s very quick. With “Analysis Logs” enabled it prints the following x51 times.

 [SonarLint Local Storage Synchronizer] INFO sonarlint - Downloaded plugin list in XXms

But it seems like it skips whatever long processes, it started in the past. It takes 3 seconds total in now.

A great improvement! Thanks :+1:

1 Like

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