Unable to load component class org.sonar.scanner.scan.filesystem.ProjectFileIndexer when doing analysis of Azure DevOps PR


(Richard Fennell) #1
  • Azure DevOps, using private build agent on Windows 10
  • Java is 64Bit Redhat OpenJDK-1.8.0.191
  • Version SonarQube 7.6.0.21501 Developer
  • SonarScanner Azure DevOps Tasks 4.5.1

I have a large code base and have successfully run SonarQube analysis against the branches

  • Master
    • feature/xxx

I create a personal branch for new work off the feature branch. Once the work was complete I try to do an Azure DevOps PR back into parent feature branch. This PR trigger Azure DevOps builds that include SonarQube analysis

For my main solution/build, when I do analysis of the PR into a parent branch the correct SonarQube.properties are automatically being set (source branch, target branch, PR ID) but the analysis task is failing with the following error

2019-02-07T10:54:00.9042997Z 10:54:00.893 INFO: Pull request 1444 for merge into feature/103908-Android-Athena-Views from fez/00000-test-sonarqube
2019-02-07T10:54:00.9167431Z 10:54:00.909 INFO: SCM collecting changed files in the branch
2019-02-07T10:54:00.9444610Z 10:54:00.940 DEBUG: readpipe [git, --version],E:\Build2\externals\git\cmd
2019-02-07T10:54:01.0959843Z 10:54:01.081 DEBUG: readpipe may return ‘git version 2.18.0.windows.1’
2019-02-07T10:54:01.0962988Z 10:54:01.081 DEBUG: remaining output:
2019-02-07T10:54:01.0966192Z
2019-02-07T10:54:01.1016652Z 10:54:01.097 DEBUG: readpipe [git, config, --system, --edit],E:\Build2\externals\git\cmd
2019-02-07T10:54:01.4085927Z 10:54:01.394 DEBUG: readpipe may return ‘E:/Build2/externals/git/mingw64/etc/gitconfig’
2019-02-07T10:54:01.4086969Z 10:54:01.394 DEBUG: remaining output:
2019-02-07T10:54:01.4087697Z
2019-02-07T10:54:01.6180391Z 10:54:01.612 INFO: ------------------------------------------------------------------------
2019-02-07T10:54:01.6180653Z 10:54:01.612 INFO: EXECUTION FAILURE
2019-02-07T10:54:01.6241067Z 10:54:01.612 INFO: ------------------------------------------------------------------------
2019-02-07T10:54:01.6243532Z 10:54:01.612 INFO: Total time: 5.718s
2019-02-07T10:54:01.6857184Z 10:54:01.675 INFO: Final Memory: 23M/226M
2019-02-07T10:54:01.6860225Z 10:54:01.675 INFO: ------------------------------------------------------------------------
2019-02-07T10:54:01.6871695Z ##[error]10:54:01.675 ERROR: Error during SonarQube Scanner execution
2019-02-07T10:54:01.6872021Z ##[debug]Processed: ##vso[task.logissue type=error;]10:54:01.675 ERROR: Error during SonarQube Scanner execution
2019-02-07T10:54:01.6872215Z 10:54:01.675 ERROR: Error during SonarQube Scanner execution
2019-02-07T10:54:01.6893042Z ##[error]java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.ProjectFileIndexer
2019-02-07T10:54:01.6893899Z ##[debug]Processed: ##vso[task.logissue type=error;]java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.ProjectFileIndexer

I have a second build triggered by the PR for a smaller solution in the same repo, on the same branch and against the same SonarQube project on the same private build agent. This works without any error, correctly detecting the change files

2019-02-07T10:17:59.8743226Z 10:17:59.861 INFO: Pull request 1444 for merge into feature/103908-Android-Athena-Views from fez/00000-test-sonarqube
2019-02-07T10:17:59.8890362Z 10:17:59.877 INFO: SCM collecting changed files in the branch
2019-02-07T10:17:59.9096338Z 10:17:59.908 DEBUG: readpipe [git, --version],E:\Build1\externals\git\cmd
2019-02-07T10:17:59.9726241Z 10:17:59.970 DEBUG: readpipe may return ‘git version 2.18.0.windows.1’
2019-02-07T10:17:59.9726895Z 10:17:59.970 DEBUG: remaining output:
2019-02-07T10:17:59.9726994Z
2019-02-07T10:17:59.9779568Z 10:17:59.970 DEBUG: readpipe [git, config, --system, --edit],E:\Build1\externals\git\cmd
2019-02-07T10:18:00.1401873Z 10:18:00.127 DEBUG: readpipe may return ‘E:/Build1/externals/git/mingw64/etc/gitconfig’
2019-02-07T10:18:00.1402441Z 10:18:00.127 DEBUG: remaining output:
2019-02-07T10:18:00.1402529Z
2019-02-07T10:18:00.2261927Z 10:18:00.220 DEBUG: Merge base sha1: 5a459451ae6f28fb1942bf75d75bd31a6793b043
2019-02-07T10:18:00.2582294Z 10:18:00.252 INFO: SCM collecting changed files in the branch (done) | time=375ms
2019-02-07T10:18:00.2582877Z 10:18:00.252 DEBUG: SCM reported 8 files changed in the branch

Is there any reason the PR check analysis should fail for the build of the larger solution?

Do I need to set some extra flag to allow more memory usage or something similar?

Note that the actual MSBUILD of the code completes without and errors prior to attempting to perform the SonarQube analysis


Unable to load component class-org-sonar-scanner-scan-filesystem-projectfileindexer for larger PRs
(Richard Fennell) #2

I have changed the category as after more testing, the problem seems to be due to the code size being analysed, no a config or usage error


(Richard Fennell) #3

Ok this is really strange. We have not make any changes to our build VMs (not even rebooted them) but the issue has gone away.

Only change I can think of is we reviewed our rule set to remove old rules. Not sure if this could have cause the issue

I will keep monitoring it


(Greg Pakes) #4

I am suddenly getting the same issue on my builds. It is a lot of code, but it has successfully been using SonarCloud for 6+ months with no issues.

Error:

2019-02-14T02:39:10.5778764Z INFO: ------------------------------------------------------------------------
2019-02-14T02:39:10.5778921Z INFO: EXECUTION FAILURE
2019-02-14T02:39:10.5779022Z INFO: ------------------------------------------------------------------------
2019-02-14T02:39:10.5779105Z INFO: Total time: 32.559s
2019-02-14T02:39:10.6206042Z ##[error]ERROR: Error during SonarQube Scanner execution
2019-02-14T02:39:10.6206788Z ERROR: Error during SonarQube Scanner execution
2019-02-14T02:39:10.6207125Z ##[error]ERROR: Unable to load component class org.sonar.scanner.scan.filesystem.ProjectFileIndexer
2019-02-14T02:39:10.6207457Z ERROR: Unable to load component class org.sonar.scanner.scan.filesystem.ProjectFileIndexer
2019-02-14T02:39:10.6207731Z ##[error]ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.filesystem.FileIndexer
2019-02-14T02:39:10.6208002Z ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.filesystem.FileIndexer
2019-02-14T02:39:10.6208265Z ##[error]ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.filesystem.MetadataGenerator
2019-02-14T02:39:10.6208541Z ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.filesystem.MetadataGenerator
2019-02-14T02:39:10.6208816Z ##[error]ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.filesystem.StatusDetection
2019-02-14T02:39:10.6209098Z ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.filesystem.StatusDetection
2019-02-14T02:39:10.6209359Z ##[error]ERROR: Caused by: Unable to load component class org.sonar.scanner.scm.ScmChangedFiles
2019-02-14T02:39:10.6209922Z ERROR: Caused by: Unable to load component class org.sonar.scanner.scm.ScmChangedFiles
2019-02-14T02:39:10.6210177Z ##[error]ERROR:
2019-02-14T02:39:10.6210589Z ERROR: 
2019-02-14T02:39:10.6210732Z INFO: Final Memory: 23M/142M
2019-02-14T02:39:10.6210899Z INFO: ------------------------------------------------------------------------
2019-02-14T02:39:10.6801258Z ##[error]The SonarQube Scanner did not complete successfully
2019-02-14T02:39:10.6802204Z The SonarQube Scanner did not complete successfully
2019-02-14T02:39:10.6862234Z 02:39:10.672  Creating a summary markdown file...
2019-02-14T02:39:10.6867737Z ##[error]02:39:10.672  Post-processing failed. Exit code: 1
2019-02-14T02:39:10.6968165Z 02:39:10.672  Post-processing failed. Exit code: 1
2019-02-14T02:39:10.7033948Z ##[error]D:\a\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.5.1\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe failed with return code: 1
2019-02-14T02:39:10.7064099Z ##[section]Finishing: Run Code Analysis

Hi @rfennell - You always seem to popup in the same places as me! In answer to your questions, I don’t think this issue is due to large solutions. We have it running on an very large solution (1.5GB+ source code) and it has been ok. Yes, we had to run it with more memory, but I don’t think this issue is related to memory or the size of the solution.


(Richard Fennell) #5

@gregpakes yes, strange isn’t it, maybe one day actually meet !

Strangely our issue just went away. Just the type of problem I hate, no real resolution or reason