Sonar-scanner, sonarcfamily, sonar for bamboo problem

Hi everyone, here are my versions

SonarQube 6.7.6
Sonar Scanner 4.0.0
SonarCFamily 6.2

sonar-scanner runs on 64bit redhat 6, building with gcc with the build wrapper downloaded from our server

I’m trying to run sonar-scanner and the he scan takes a while to complete(1+ hour) with only 40 active rules and 50k lines of code. Eventually the scan completes, but the task hangs after it says execution success. Here are some debug logs

Logs of the scan taking so long



|build|21-Aug-2019 13:20:01|16:20:01.692 INFO: [pool-3-thread-3] <filePath 1>
|build|21-Aug-2019 13:20:13|16:20:13.016 INFO: [pool-3-thread-4] <filePath 2>
|build|21-Aug-2019 14:20:14|17:20:14.908 INFO: 341 compilation units analyzed|
|build|21-Aug-2019 14:20:14|17:20:14.911 INFO: Sensor CFamily [cpp] (done) | time=4686885ms|

As you can see it takes exactly an hour to go from analyzing a file to completition of CFamily. I tried excluding that last file but it still takes an hour, so its not that file

Here is the log for the hang

build 20-Aug-2019 19:06:46 22:06:46.765 INFO: EXECUTION SUCCESS
build 20-Aug-2019 19:06:46 22:06:46.765 INFO: ------------------------------------------------------------------------
build 20-Aug-2019 19:06:46 22:06:46.765 INFO: Total time: 1:10:23.475s
build 20-Aug-2019 19:06:47 22:06:47.138 INFO: Final Memory: 81M/783M
build 20-Aug-2019 19:06:47 22:06:47.138 INFO: ------------------------------------------------------------------------
error 21-Aug-2019 00:27:42 Force Stop build feature is enabled for current plan. Either Bamboo has detected the build has hung or it has been manually stopped.
simple 21-Aug-2019 00:27:42 Attempting to generate stack trace and terminate spawned sub-processes of process id: 12501
simple 21-Aug-2019 00:27:42 Found related process: pid: 11822 ppid: 1 pgid: 28858 %cpu: 0.0 %mem: 0.0 cmd:/.scannerwork/.sonartmp/458520052420169267/subprocess
simple 21-Aug-2019 00:27:42 Found related process: pid: 28669 ppid: 1 pgid: 28858 %cpu: 0.0 %mem: 2.7 cmd:/.scannerwork/.sonartmp/5653017013302457335/subprocess
simple 21-Aug-2019 00:27:42 Found related process: pid: 11966 ppid: 1 pgid: 28858 %cpu: 0.0 %mem: 0.0 cmd: /.scannerwork/.sonartmp/458520052420169267/subprocess
simple 21-Aug-2019 00:27:42 Found related process: pid: 28815 ppid: 1 pgid: 28858 %cpu: 0.0 %mem: 2.7 cmd: /.scannerwork/.sonartmp/5653017013302457335/subprocess
simple 21-Aug-2019 00:27:42 getStackTraceAndKillRelatedProcesses for 4 processes
simple 21-Aug-2019 00:27:42 Executing kill -3 28815
simple 21-Aug-2019 00:27:42 Executing kill -3 11966
simple 21-Aug-2019 00:27:42 Executing kill -3 28669
simple 21-Aug-2019 00:27:42 Executing kill -3 11822
simple 21-Aug-2019 00:27:47 Killing: 28815
simple 21-Aug-2019 00:27:47 Executing kill 28815
simple 21-Aug-2019 00:27:47 Killing: 11966
simple 21-Aug-2019 00:27:47 Executing kill 11966
simple 21-Aug-2019 00:27:47 Killing: 28669
simple 21-Aug-2019 00:27:47 Executing kill 28669
simple 21-Aug-2019 00:27:47 Killing: 11822
simple 21-Aug-2019 00:27:47 Executing kill 11822

It looks like the subprocesses from sonar-scanner don’t exit so it doesn’t finish. The sonar-scanner process ends.

Does anyone know why that would happen? Additionally, does anyone know why my CFamily scan would take that long?

Hi @jesus.shuttleworth,

could you please try again with SonarCFamily version 6.3?

Unfortunately I am unable to upgrade SonarCFamily at the moment. I will let you know when I can. We use this version of SonarCFamily for other projects and this doesn’t happen.

I boiled down the problem to one file, when I remove that file the scan finishes in 10 minutes. Looks like SonarCFamily just hangs on one file for an hour then proceeds but the process never gets killed.

Any idea what can be causing it to hang on one file? I deactivated all my rules and it still hangs on that file regardless. I don’t see anything special about that file, no dependencies or anything.

Hi @jesus.shuttleworth,

the problem might have already been fixed, that’s why it would be nice to see if the problem persists in SonarCFamily 6.3, before starting the investigation.

Hi @mpaladin

Unfortunately I didn’t get the okay to upgrade to SonarCFamily 6.3. But moving from Redhat 6.7 to Redhat 6.9 ended up fixing the problem. Not sure exactly why.

Hi @jesus.shuttleworth,

thank you for the update, I am glad you fixed it. BTW, SonarCFamily 6.4 is about to be released.