Open rngh101 opened 4 years ago
Could you take threaddump by jcmd
tool?
It's better to take threaddump several times like this page, then we can compare them to grasp how threads were working.
Hello , PFA zip file which contains "jcmd_threaddump.out" and "top_highcpu.out" for analysis.
Thanks. I found that the code is stacked around FindbugsConfiguration.scanForAdditionalClasses()
:
I guess that we need to use the FileVisitor or streaming API to be more lazy.
"main" #1 prio=5 os_prio=0 tid=0x00007f1690008d70 nid=0x95b7 runnable [0x00007f1699229000]
java.lang.Thread.State: RUNNABLE
at org.sonar.plugins.findbugs.FindbugsConfiguration.scanForAdditionalClasses(FindbugsConfiguration.java:191)
at org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:85)
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:119)
at org.sonar.plugins.findbugs.FindbugsSensor.execute(FindbugsSensor.java:119)
at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
"main" #1 prio=5 os_prio=0 tid=0x00007f1690008d70 nid=0x95b7 runnable [0x00007f1699229000]
java.lang.Thread.State: RUNNABLE
at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:242)
at java.io.File.isFile(File.java:882)
at org.sonar.plugins.findbugs.FindbugsConfiguration.scanForAdditionalClasses(FindbugsConfiguration.java:194)
at org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:85)
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:119)
at org.sonar.plugins.findbugs.FindbugsSensor.execute(FindbugsSensor.java:119)
"main" #1 prio=5 os_prio=0 tid=0x00007f1690008d70 nid=0x95b7 runnable [0x00007f1699229000]
java.lang.Thread.State: RUNNABLE
at java.io.UnixFileSystem.list(Native Method)
at java.io.File.list(File.java:1122)
at java.io.File.listFiles(File.java:1207)
at org.sonar.plugins.findbugs.FindbugsConfiguration.scanForAdditionalClasses(FindbugsConfiguration.java:191)
at org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:85)
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:119)
at org.sonar.plugins.findbugs.FindbugsSensor.execute(FindbugsSensor.java:119)
at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
Thanks @KengoTODA for looking into this.
Couple of queries:
a) Do you mean that the plugin's scanForAdditionalClasses needs certain refactoring? Could you please explain why the thread may be getting stuck?
b) We did a couple of changes in the sonar-scanner-cli commandline: Disabled the Java plugin :: -Dsonar.excludePlugins=java,web,perl,ts,go Updated the java binaries path :: -Dsonar.java.binaries=./ims_do/java/ (Earlier sonar.java.binaries was configured as ".")
With these changes, the FindBugs sensor is not entering the "stuck/hung state". Instead it is logging a couple of WARNINGs and skipping execution: 14:13:20.477 INFO: Sensor jsp [findbugs] 14:13:20.712 INFO: Sensor jsp [findbugs] (done) | time=235ms 14:13:20.712 INFO: Sensor FindBugs Sensor [findbugs] 14:13:21.362 INFO: JavaClasspath initialization 14:13:21.425 INFO: JavaClasspath initialization (done) | time=63ms 14:13:21.445 WARN: Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for Findbugs to analyse your (sub)project (PROJECT PATH) 14:13:21.445 WARN: JSP files were found in the current (sub)project (PROJECT_PATH) but FindBugs requires their precompiled form. For more information on how to configure JSP precompilation : https://github.com/find-sec-bugs/find-sec-bugs/wiki/JSP-precompilation 14:13:21.458 INFO: Findbugs analysis skipped for this project. 14:13:21.459 INFO: Sensor FindBugs Sensor [findbugs] (done) | time=747ms
So, was setting the top-level directory "." as the sonar binaries path, the reason for the hung state?
c) In the original issue description, Java files have been marked as excluded? Still why is FindBugs sensor getting triggered for analysis? Is it because .jsp was not added in the exclusion list?
14:13:21.445 WARN: Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for Findbugs to analyse your (sub)project (PROJECT PATH) 14:13:21.445 WARN: JSP files were found in the current (sub)project (PROJECT_PATH) but FindBugs requires their precompiled form. For more information on how to configure JSP precompilation : https://github.com/find-sec-bugs/find-sec-bugs/wiki/JSP-precompilation
This means that, your project contains some .jsp
files but no .class
file. In short your project configuration is incorrect.
c) In the original issue description, Java files have been marked as excluded? Still why is FindBugs sensor getting triggered for analysis?
Not sure. Recheck your config.
a) Do you mean that the plugin's scanForAdditionalClasses needs certain refactoring? Could you please explain why the thread may be getting stuck?
I'm still working in the branch issue-318, but I haven't finished integrated test due to slow network yet.
@rngh101 I confirmed that the plugin itself is working, could you compare its performance with 4.0.0 in your env? You can build and install the plugin file like below:
git clone git@github.com:spotbugs/sonar-findbugs.git
cd sonar-findbugs
git checkout issue-318
mvn package
cp target/sonar-findbugs-plugin.jar $SONARQUBE_HOME/extensions/plugins/
If we can confirm the performance improvement, I'll merge changes and release it as 4.0.1 (or later).
Issue Description
While running SonarQube analysis of a multi-language large codebase project using sonar-scanner-cli, the analysis seems to be getting stuck in FindBugs sensor step. The analysis does not proceed either to successful completion, nor does it terminate abruptly with any error message. It stays hung.
To reduce the scope, we excluded a few languages like Java, Go, Perl, Typescript etc.
The analysis does not proceed further and stays stuck here.
Environment