spotbugs/sonar-findbugs

Findbugs timeout issue

eshwarkarthikn opened this issue · 6 comments

Hi,

Our analysis is getting failed with below error. We face this issue before but it got rectified after resolving missing class dependencies. But now, though there is no error in debug logs, we see this findbugs timeout issue. I've also tried increasing the timeout value to 36000000 from default value 6000000. We are using v4.2.3 which we updated recently while upgrading sonarqube to v9.9 LTS.

Error:

BUILD FAILED
/root/product.xml:32: java.lang.IllegalStateException: Can not execute Findbugs with a timeout threshold value of 6000000 milliseconds
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:186)
at org.sonar.plugins.findbugs.FindbugsSensor.execute(FindbugsSensor.java:130)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61)
at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:403)
at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399)
at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.ant.SonarQubeTask.launchAnalysis(SonarQubeTask.java:113)
at org.sonarsource.scanner.ant.SonarQubeTask.execute(SonarQubeTask.java:94)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:853)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Caused by: java.util.concurrent.TimeoutException
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204)
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:182)
... 46 more

Total time: 211 minutes 58 seconds

Could you please help me to fix this issue
@gtoison @cachescrubber

Thank you for reporting the issue, this could happen for various reasons and depending on the cause I would need more details:

  • The JVM is running out of memory: the analysis is running inside your build so you would need to check if Ant might be running out of memory (e.g. with JVisualVM or by allocating more memory)
  • There's some kind of infinite loop: that would be a bug but I would need some way of reproducing it. Sharing a few thread dumps (e.g. using JVisualVM) might help locating the problem.
  • There's a performance problem: how much code are you analysing, can you share the number of lines or files? Again, sharing some thread dumps would help seeing what's happening.

Now if you can, sharing some CPU profiling data of the Ant would be even better than some thread dumps.

Hi,

Thank you for the prompt response. I have informed the user about your comments. I will share thread dumps once i get it from dev team.

eshwarkarthikn

We had a similar issue. After upgrading sonar on our dev environment to 9.9, which automatically comes with findbugs version 4.2.3, some of the projects were failing because of the timeout issue.

Fortunatelly, the sonar from production has not been updated yet and that one was running with findbugs 4.2.1. To fix this issue, I copied the 4.2.1 version from production into the development sonar, removed the 4.2.3 version and restarted sonar. Then I've increased the timeout to 20 mins and this seems to fix the issue for us.

Give it a try and see of it works for you

@PetreVane can you try with 4.2.3? You have updated the timeout value, that most likely fixed your problem; I wouldn't expect that reverting to 4.2.1 helped here.
In case you need to get another version they are available on maven central or on the project's releases page

@gtoison yes, we've reverted to the latest version and increased the timeout, as the time-out issue was happening only for certain projects. It doesn't happen anymore but in some projects, it takes ip to 20 mins to finish scanning, which was not happening with sonar 8.. + findbugs 4.2.1

On the plugin side the significant change between these versions is that the code corresponding to Unit Tests is now analyzed.
You can try disabling that with the sonar.findbugs.analyzeTests option to remove that change from the equation.