"Checking SonarLint Binding Updates" running almost continuously

Please provide

  • Operating system: Windows 10
  • SonarLint plugin version: 7.4.0.60471
  • Programming language you’re coding in: Java and Kotlin
  • Is connected mode used:
    • Connected to SonarCloud or SonarQube (and which version): SonarQube Developer Edition Version 9.6.1 (build 59531)

And a thorough description of the problem / question:

For myself and all of my team members, the “Checking SonarLint Binding Updates” background task is now running almost continuously (for 10s of minutes at a time at least). Occasionally when I look it’s not running, but before long it’s back.

I can browse the web interface for the bound SonarQube instance from the same system as my IDE no problem. It’s fast and reliable.

I’m not getting any error or timeout pop-ups, nor anything related in the Notifications tool window. I searched idea.log for “sonar”, but don’t see anything that appears relevant.

I noticed “SLI-776: Never ending tasks because of HTTP requests” reported as fixed in the latest release notes. I’m not sure whether that could be related at all.

Is there anything I could do to further troubleshoot or provide diagnostic info for this issue?

1 Like

Hello Ian,

Thanks for raising this here. The ticket you mentioned was supposed to fix this issue, but there is probably another cause. Could you please capture a thread dump at the time you face this problem and share it with us ?

Thread dump taken with “Checking SonarLint Binding Updates” background task active:
threadDump-20230130-120228.txt (517.6 KB).

I have the same problem,

  • Operating system: Ubuntu 22
  • SonarLint plugin version: 7.4.0.60471
  • Programming language you’re coding in: Java
  • Is connected mode used:
    • Connected to SonarCloud or SonarQube (and which version): * Community Edition
  • Version 9.5 (build 56709)

My thread dump looks similar to Ian’s:
threadDump-20230208-222719.txt (256.8 KB)

1 Like

Hello there,

Sorry for the late update. Thanks for the thread dumps, it is useful, and I confirm that it’s not related to the ticket you linked in your first post and that we fixed for the latest release.

As you can see in the thread dump you both provided, SonarLint relies on git4idea, the internal Git integration plugin from JetBrains. It is used to identify the merge base between 2 commits or branches, which is helpful for us to match the current local Git branch with the server one.

It seems this command is taking a long time, which can be caused by 2 factors:

  • there are a lot of branches for this project on your SonarQube server.
  • the command itself is taking a long time, which could be caused by (random guesses at this point):
    • a big distance between your current HEAD and the server branch ?
    • a big Git repo ?
    • an old Git version ?

I will take some more time to investigate, in the meantime feel free to give more details about your configuration regarding the previous possible causes. If you are able to provide a reproducer with a simple project, that would also greatly help us!

I upgraded to SonarLint 8.0.0.63273 and SonarQube 9.9.0.65466. No change.

My git repo currently has 190 branches, but we don’t have branch or PR scanning setup, so the only branch being scanned is master. I currently have 9 branches checked out locally. All are close to master. I’m almost always fetch --alled and working at HEAD.

My local .git directory is 2.5GB. Code size according to SonarQube is 1.3M lines.

My local Git version is 2.37.1.windows.1.

The project in question is closed source, and the server is not on a public network, so I’m not sure how I could provide a reproducer. I’d be happy to perform requested troubleshooting or provide whatever further information I could otherwise.

Upgraded to 8.1.0.65508. No apparent change.

After the SonarQube 9.9 upgrade I was expecting to see the Security Hotspots tab populated, but it still said I was not connected to a SonarQube 9.7+ server. I tried “Settings > Tools > SonarLint > Project Settings > Update local storage”. While it did complete, and I now see “No security hotspot found” on the tab, the corresponding background task took around 1/2 hour, so that’s another apparent long-running background task. I’m not sure whether it could be related to the long-running binding updates task at all.

A minor thing, but perhaps the tab should read “No security hotspots found” when in that state.

Hello Ian,

Could you try to install this version ? I added more logs around the branch resolution, could you open the logs tab in the SonarLint tool window and check if SonarLint is stucked on a specific log ?

EDIT: see how to install a custom version

I installed the linked version, 8.2.0.65545. Here’s all that’s in the logs tab after starting up and running for a few hours this morning (names were changed to protect the innocent):

Using connection 'My SonarQube Server' for project 'MyProject'
Analysing 'SomeTest.kt'...
Using connection 'My SonarQube Server' for project 'MyProject'
Analysing 4 files...
Using connection 'My SonarQube Server' for project 'MyProject'
Analysing 'SomeIT.kt'...
Using connection 'My SonarQube Server' for project 'MyProject'
Analysing 'build.gradle.kts'...
Using connection 'My SonarQube Server' for project 'MyProject'
Analysing 'SomeApp.java'...
Using connection 'My SonarQube Server' for project 'MyProject'
Analysing 'build.gradle.kts'...
Found 13 issues and 0 hotspots
Using connection 'My SonarQube Server' for project 'MyProject'
Analysing 'SomeTest.kt'...
Using connection 'My SonarQube Server' for project 'MyProject'
Analysing 4 files...
Using connection 'My SonarQube Server' for project 'MyProject'
Analysing 'SomeIT.kt'...
Using connection 'My SonarQube Server' for project 'MyProject'
Analysing 'build.gradle.kts'...
Using connection 'My SonarQube Server' for project 'MyProject'
Analysing 'SomeApp.java'...
Using connection 'My SonarQube Server' for project 'MyProject'
Analysing 'build.gradle.kts'...
Found 13 issues and 0 hotspots

It’s currently checking binding updates as of this capture.

Those entries seem to be logged each time I open a file for edit, so in other words, I don’t see any entries that appear to coincide with the start or eventual finish of the “Checking SonarLint Binding Updates” background task.

I upgraded to IntelliJ 2023.1 Ultimate, and noticed some new entries in the log:

Getting merge base from HEAD=736101d1b8245fc994b6cd92a6106498fdde2d26 to 89d55b02b78b66a9a6047a81ac8212f48fd1cce7
Found merge base 736101d1b8245fc994b6cd92a6106498fdde2d26
Number of commits ahead=0 
Number of commits behind=0 
Best candidates are [master]

This occurs twice at the start of the log. No change otherwise. I still observe long-running “Checking SonarLint Binding Updates” background tasks. I upgraded in place, so I’m still running the provided 8.2.0.65545.

In my case I had more then 500 local branches in a big and old git repo.
Deleting unnecessary branches (down to just several) resolved my problem with “Checking SonarLint Binding Updates…” in IntelliJ.

2 Likes

Thanks for the update Tomasz :slight_smile:

This confirms my earlier suspicion:

I presume for some of those old branches, the computation of the merge base is costly.

@ianbrandt could you try to apply the same workaround and prune local branches ?

Hi @Damien_Urruty,

I’d removed my remote binding configuration pending an update here. I’ve just updated to 8.2.0.68615, and configured my binding connection anew. I’m not seeing long-running “Checking SonarLint Binding Updates” background tasks so far, and previously would have by now.

My local Git clone hasn’t changed much from what I outlined above. Per git branch, I have 12 local branches. All are very close to master. I have a single remote, “origin”. Per git remote show origin, it has a couple hundred branches. Some of those are very different from master. Per git branch -r, I have remote tracking branches for all of them locally (obtained updated via regular use of git fetch --all). My SonarQube server is only configured to scan “origin/master”.

I’ll follow up if the long-running background task returns for me, or if it is still occurring for my teammates after they’ve upgraded to the new 8.2.0.68615 SonarLint version.