15

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=.
slartidan
  • 20,403
  • 15
  • 83
  • 131
Parth Mewada
  • 151
  • 1
  • 1
  • 4
  • Provide the version of SonarQube you are using and in the meantime, have a look at the server logs, you should find an error and a stacktrace in there – Seb - SonarSource Team Apr 03 '17 at 11:50
  • Run the sonar-scanner with `-X` flag, and you will see the error (POST 500). Not sure what causes it, though – c69 Jun 21 '17 at 15:26

3 Answers3

34

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.

c69
  • 19,951
  • 7
  • 52
  • 82
  • 2
    Had the exact same problem and this solved it for me. Many thanks on the heads up about restarting both MySQL and SonarQube; originally only restarted MySQL and it still wasn't working. Restarting both did the job :) – Novastorm Jan 04 '18 at 09:44
2

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

Yves Martin
  • 10,217
  • 2
  • 38
  • 77
0

I had the same problem. I have resolved that issue instead of changing in my.ini file I have excluded an unnecessary folder from sonar. You can do that from the administration setting tab.

Deepak Kumbhar
  • 484
  • 7
  • 17