Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonarqube scanner report upload error 500

When every I create a new project with SonarQube project properties, I get this error:

04:13:57.939 DEBUG: Upload report
04:14:11.533 DEBUG: POST 500 sonarserverurl/api/ce/submit?projectKey=Somename&projectName=Somename | time=13580ms
04:14:11.540 INFO: ------------------------------------------------------------------------
04:14:11.540 INFO: EXECUTION FAILURE
04:14:11.540 INFO: ------------------------------------------------------------------------
04:14:11.540 INFO: Total time: 2:25.443s
04:14:11.639 INFO: Final Memory: 56M/647M
04:14:11.639 INFO: ------------------------------------------------------------------------
04:14:11.639 ERROR: Error during SonarQube Scanner execution
org.sonarqube.ws.client.HttpException: Error 500 on sonarserver:9000/api/ce/submit?projectKey=Some name&projectName=Some name* : {"errors":[{"msg":"An error has occurred. Please contact your administrator"}]}
        at org.sonarqube.ws.client.BaseResponse.failIfNotSuccessful(BaseResponse.java:36)
        at org.sonar.scanner.bootstrap.ScannerWsClient.failIfUnauthorized(ScannerWsClient.java:106)
        at org.sonar.scanner.bootstrap.ScannerWsClient.call(ScannerWsClient.java:75)
        at org.sonar.scanner.report.ReportPublisher.upload(ReportPublisher.java:177)
        at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:131)
        at org.sonar.scanner.phases.PublishPhaseExecutor.publishReportJob(PublishPhaseExecutor.java:71)
        at org.sonar.scanner.phases.PublishPhaseExecutor.executeOnRoot(PublishPhaseExecutor.java:53)
        at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:79)
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:175)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:262)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:257)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:247)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
        at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
        at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
        at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:118)
        at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:117)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        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:233)
        at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
        at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)
04:14:11.640 DEBUG: Execution getVersion
04:14:11.640 DEBUG: Execution stop

My sonar-project.properties file is:

sonar.host.url=http : // sonarqube_server:9000
sonar.projectKey=sonar.org:projectname
sonar.projectName=WP_projectname
sonar.projectVersion=1.0
sonar.exclusions=bower_components/**,public_html/bower_components/**
sonar.sources=.
like image 322
Parth Mewada Avatar asked Mar 31 '17 14:03

Parth Mewada


2 Answers

The problem often is that SonarQube generates a huge report and then tries to upload it in one shot, causing HTTP 500, because MySQL refuses to accept such a large request body.

The quick fix is to change the server config (my.ini file), to increase packed size (from default 4MB, to whatever is your report size):

[mysqld]
max_allowed_packet = 16M

per https://groups.google.com/forum/#!msg/sonarqube/c_DcwoN4qlg/wmnosoJkBAAJ

p.s.: you will also need to restart both MySQL and sonar services to apply changes.

like image 84
c69 Avatar answered Oct 11 '22 19:10

c69


I faced same issue with following error message visible in sonarqube-6.7.4/logs/web.log:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: The size of BLOB/TEXT data
inserted in one transaction is greater than 10% of redo log size.
Increase the redo log size using innodb_log_file_size.

Again, best option is to reduce report archives size excluding non relevant folders or files.

By the way, if you really have to tune MySQL for 30 MiB compressed reports, you may create /etc/mysql/conf.d/sonarqube.cnf on Debian-based Linux system with content:

# Work-around Sonarqube large report storage trouble
[mysqld]
innodb_log_file_size = 150994944

Reference: https://dev.mysql.com/doc/refman/5.6/en/innodb-parameters.html#sysvar_innodb_log_file_size

like image 33
Yves Martin Avatar answered Oct 11 '22 20:10

Yves Martin