SonarQube analysis with C++

SonarQube version: 8.0-developer-beta (using Docker)
SonarScanner version: 4.2.0.1873 (with openjdk-11-jdk installed).
SonarCFamily Plugin with Wrapper.


Trying to complete analysis of a C++ project and have it uploaded to SonarQube. Managed to use the build-wrapper-linux-x86-64 around the make command and then run the sonar-scanner command in GitLab CI.


We get the following error:

 09:57:44.097 INFO: CPD Executor CPD calculation finished (done) | time=2655ms
10698 09:57:44.382 INFO: SCM writing changed lines
10699 09:57:44.385 DEBUG: SCM reported changed lines for 0 files in the branch
10700 09:57:44.385 INFO: SCM writing changed lines (done) | time=3ms
10701 09:57:44.552 INFO: Analysis report generated in 288ms, dir size=8 MB
10702 09:57:47.889 INFO: Analysis report compressed in 3337ms, zip size=5 MB
10703 09:57:47.889 INFO: Analysis report generated in /builds/<group>/<repo>/.scannerwork/scanner-report
10704 09:57:47.889 DEBUG: Upload report
10705 09:57:48.178 INFO: ------------------------------------------------------------------------
10706 09:57:48.179 INFO: EXECUTION FAILURE
10707 09:57:48.179 INFO: ------------------------------------------------------------------------
10708 09:57:48.179 INFO: Total time: 7:17.807s
10709 09:57:48.257 INFO: Final Memory: 23M/114M
10710 09:57:48.257 INFO: ------------------------------------------------------------------------
10711 09:57:48.257 ERROR: Error during SonarQube Scanner execution
10712 java.lang.IllegalStateException: Fail to request https://sonarqube.<company>.co.uk/api/ce/submit?projectKey=<projectKey>&characteristic=branch%3Dsonar&characteristic=branchType%3DSHORT
10713 	at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:200)
10714 	at org.sonarqube.ws.client.HttpConnector.post(HttpConnector.java:155)
10715 	at org.sonarqube.ws.client.HttpConnector.call(HttpConnector.java:114)
10716 	at org.sonar.scanner.bootstrap.DefaultScannerWsClient.call(DefaultScannerWsClient.java:73)
10717 	at org.sonar.scanner.report.ReportPublisher.upload(ReportPublisher.java:192)
10718 	at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:141)
10719 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:354)
10720 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
10721 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
10722 	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
10723 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
10724 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
10725 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
10726 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
10727 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
10728 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10729 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
10730 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
10731 	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
10732 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
10733 	at com.sun.proxy.$Proxy0.execute(Unknown Source)
10734 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
10735 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
10736 	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
10737 	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
10738 	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
10739 Caused by: okhttp3.internal.http2.StreamResetException: stream was reset: NO_ERROR
10740 	at okhttp3.internal.http2.Http2Stream.checkOutNotClosed(Http2Stream.java:635)
10741 	at okhttp3.internal.http2.Http2Stream$FramingSink.emitFrame(Http2Stream.java:560)
10742 	at okhttp3.internal.http2.Http2Stream$FramingSink.write(Http2Stream.java:540)
10743 	at okio.ForwardingSink.write(ForwardingSink.java:35)
10744 	at okhttp3.internal.connection.Exchange$RequestBodySink.write(Exchange.java:231)
10745 	at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:179)
10746 	at okio.RealBufferedSink.writeAll(RealBufferedSink.java:107)
10747 	at okhttp3.RequestBody$3.writeTo(RequestBody.java:171)
10748 	at okhttp3.MultipartBody.writeOrCountBytes(MultipartBody.java:173)
10749 	at okhttp3.MultipartBody.writeTo(MultipartBody.java:114)
10750 	at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:69)
10751 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
10752 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
10753 	at org.sonarqube.ws.client.OkHttpClientBuilder.addHeaders(OkHttpClientBuilder.java:208)
10754 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
10755 	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:43)
10756 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
10757 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
10758 	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
10759 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
10760 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
10761 	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
10762 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
10763 	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
10764 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
10765 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
10766 	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:221)
10767 	at okhttp3.RealCall.execute(RealCall.java:81)
10768 	at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:198)
10769 	... 25 more

Have also tried re-running the job in GitLab, and this other error also does pop up, if this is any help with debugging:

3530 Caused by: okhttp3.internal.http2.StreamResetException: stream was reset: NO_ERROR

Please let me know if you need any further information!

Thanks in advance.

Hi,

You got an error when the analysis report was submitted to the server. This is generally caused by something on the network (firewall? proxy? …) between the analysis machine and the SonarQube server. I would look there first.

 
HTH,
Ann

1 Like

Hi,

Thanks for the response!

I changed the log level in SonarQube to Debug and had a look at the sonarqube_ce.log and a bunch of these messages came out:

2019.12.04 11:28:49 INFO  ce[][o.s.s.l.ServerLogging] Level of logs changed to DEBUG
2019.12.04 11:29:39 DEBUG ce[][o.postgresql.Driver] Connecting with URL: jdbc:postgresql://db:5432/sonar
2019.12.04 11:29:39 DEBUG ce[][o.p.c.v.ConnectionFactoryImpl] Trying to establish a protocol version 3 connection to db:5432
2019.12.04 11:29:39 DEBUG ce[][o.p.c.v.ConnectionFactoryImpl] Receive Buffer Size is 186,240
2019.12.04 11:29:39 DEBUG ce[][o.p.c.v.ConnectionFactoryImpl] Send Buffer Size is 43,520

Would this be related?

On another note, I have managed to do successful analysis of other smaller projects…

Hi,

Those debug messages aren’t related.

Again, this points the finger for me at something on the network between the analysis machine and the SonarQube server.

 
Ann

1 Like

Hi,

You are completely right - I looked at the nginx logs on the SonarQube server, and found an error looking like: [error] 95#95: *77110 client intended to send too large body: 5454299 bytes

Updating client_max_body_size for nginx resolved the issue.

Thanks again for your assistance!

3 Likes

Hi lawrence,

Please can you describe how is your docker config?
Im having problem cause we have a proxy inside and i have problem when connecting with Gitlab.
Some config files would be helpfully.
Thanks.

Hi,

It’s basically the SonarQube 8.x first installation in https://hub.docker.com/_/sonarqube however in a docker-compose file.

And then NGINX and the others are outside the installation.

Yes i did exactly the same. So i used it with docker-compose and i can login everything ok with local account admin but with gitlab accounts i cant because i have problems with proxy.
But how is the nginx configurations.
Can you send me your docker-compose just to understand your config regarding the whole infrastructure.
My gitlab is running in a Windows Server into the same Network.
So im interested to the nginx parts and other configs. Thank you

so @lawrence can you help me with the config files?
It will be really helpfully.

Hi,

It might be worth posting this on new thread as your question isn’t related to my original question and so that other community members with more knowledge than me can help as I’ve only been doing this recently!

It’ll also be worth posting what you have tried and your configuration files, as I don’t have much idea of what you’ve tried so far either :slight_smile:

1 Like