SonarLint Eclipse: Updating project bindings hangs on 100%

Software:

  • Eclipse IDE for RCP and RAP Developers version 2019-12 (4.14.0)
  • SonarLint Eclipse versions 4.3.0.12432, 5.0.0.15138

Description:
When SonarLint Eclipse updates project bindings, it hangs forever when it reaches 100%. It is not possible to cancel the task - it only displays (Cancel Requested), but the task stays there forever.
The issue affects many (if not all) developers in our team. We usually have more than 700 projects in workspace. Can the problem be caused by the workspace size or server settings?

Steps to reproduce:

  • Open the SonarLint Bindings view
  • Right-click the server
  • Select Update All Project Bindings

Workaround:

  • The only way to cancel the hanging update is to restart Eclipse.

Please tell if I have to provide more information or if I can assist in solving the problem in any other way.

Hi @htfv

Would it be possible for you to generate a thread dump, to have a stacktrace and find the location in our code where it is stuck?

Thanks

Hello Julien,

Sure, here you go:

"Worker-21: Update SonarLint binding data from 'EDITED'" #3075 prio=5 os_prio=0 cpu=398703.13ms elapsed=1183.06s tid=0x0000028af72d1800 nid=0x136c runnable  [0x000000e3293fd000]
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.core.internal.preferences.ImmutableMap$ArrayMap.shareStrings(ImmutableMap.java:172)
        at org.eclipse.core.internal.preferences.EclipsePreferences.shareStrings(EclipsePreferences.java:1094)
        at org.eclipse.core.internal.preferences.EclipsePreferences.shareStrings(EclipsePreferences.java:1098)
        at org.eclipse.core.internal.preferences.EclipsePreferences.shareStrings(EclipsePreferences.java:1098)
        at org.eclipse.core.internal.preferences.EclipsePreferences.shareStrings(EclipsePreferences.java:1098)
        at org.eclipse.core.internal.preferences.PreferencesService.shareStrings(PreferencesService.java:966)
        at org.eclipse.core.internal.preferences.PreferencesService.applyPreferences(PreferencesService.java:215)
        at org.eclipse.core.internal.resources.ProjectPreferences.read(ProjectPreferences.java:212)
        at org.eclipse.core.internal.resources.ProjectPreferences.updatePreferences(ProjectPreferences.java:280)
        at org.eclipse.core.internal.resources.File.updateMetadataFiles(File.java:384)
        at org.eclipse.core.internal.localstore.RefreshLocalVisitor.visit(RefreshLocalVisitor.java:306)
        at org.eclipse.core.internal.localstore.UnifiedTree.accept(UnifiedTree.java:118)
        at org.eclipse.core.internal.localstore.FileSystemResourceManager.refreshResource(FileSystemResourceManager.java:977)
        at org.eclipse.core.internal.localstore.FileSystemResourceManager.refresh(FileSystemResourceManager.java:960)
        at org.eclipse.core.internal.resources.AliasManager.updateAliases(AliasManager.java:727)
        at org.eclipse.core.internal.resources.File.internalSetContents(File.java:303)
        at org.eclipse.core.internal.resources.File.setContents(File.java:336)
        at org.eclipse.core.internal.resources.ProjectPreferences.lambda$0(ProjectPreferences.java:639)
        at org.eclipse.core.internal.resources.ProjectPreferences$$Lambda$1178/0x0000000801de1440.run(Unknown Source)
        at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2292)
        at org.eclipse.core.internal.resources.ProjectPreferences.save(ProjectPreferences.java:671)
        at org.eclipse.core.internal.preferences.EclipsePreferences.internalFlush(EclipsePreferences.java:434)
        at org.eclipse.core.internal.resources.ProjectPreferences.flush(ProjectPreferences.java:371)
        at org.sonarlint.eclipse.core.internal.resources.SonarLintProjectConfigurationManager.save(SonarLintProjectConfigurationManager.java:115)
        at org.sonarlint.eclipse.core.internal.SonarLintCorePlugin.saveConfig(SonarLintCorePlugin.java:199)
        at org.sonarlint.eclipse.core.internal.server.Server.lambda$23(Server.java:415)
        at org.sonarlint.eclipse.core.internal.server.Server$$Lambda$1160/0x0000000801dd6c40.accept(Unknown Source)
        at java.util.ArrayList.forEach(java.base@13.0.2/ArrayList.java:1507)
        at org.sonarlint.eclipse.core.internal.server.Server.updateProjectStorage(Server.java:408)
        - locked <0x00000007415352d8> (a org.sonarlint.eclipse.core.internal.server.Server)
        at org.sonarlint.eclipse.core.internal.jobs.ServerUpdateJob.lambda$0(ServerUpdateJob.java:69)
        at org.sonarlint.eclipse.core.internal.jobs.ServerUpdateJob$$Lambda$1129/0x0000000801dbc840.accept(Unknown Source)
        at java.util.Optional.ifPresent(java.base@13.0.2/Optional.java:176)
        at org.sonarlint.eclipse.core.internal.jobs.ServerUpdateJob.run(ServerUpdateJob.java:67)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

   Locked ownable synchronizers:
        - None

What if you enable verbose output in the SonarLint console? Is the process really stuck, or just processing slowly? Do you see logs like:

Detected prefixes for <project>: [...]

Seems like it is going slowly. It prints the following lines once in ~10 seconds:

Detected prefixes for EDITED:
  IDE prefix: EDITED
  Server side prefix: EDITED

Good, that help. Could you please confirm if all the Eclipse projects are bound to the same SonarQube project?
Seems this SonarQube project has a lot of files (~15k). Is it correct?

There are more than 1300 Eclipse projects with more than 31000 Java files in single git repository. Developers usually have about 700-750 of those projects open in Eclipse, all of them connected to one SonarQube project.

Perfect, thanks for all the details. I think this is purely a performance issue of our algorithm that is used to auto-detect modules prefixes/suffixes.
I have created a ticket to improve that in the next version:
https://jira.sonarsource.com/browse/SLE-344

Thank you for quick response!