Work Around For Simultaneous SonarQube Scans

I’m using SonarQube Enterprise 8.9 and I occasionally have these errors

It looks like an analysis of 'ProjectName is already running (started 4 minutes ago)

Which I’m guessing might be because there are two analyses running simultaneously.

In older versions of SonarQube, the -Dsonar.forceAnalysis=true flag could be set but it looks like it’s now been deprecated.

Is there a way to deal with this issue of simultaneous builds failing in newer versions of SonarQube?

Hello,
Where exactly do you see that error message?

Hi Duarte,

The error appeared in a Jenkins console output as part of the SonarQube Scan stage.

The scan failed and threw out the error. And so, I waited for the first scan to finish before re-running the job and it worked.

It’s happened a few times, hence my curiosity,

Could you please post the full error stack trace?
We are still unsure where the message is coming from.

Hi @dmeneses

Thanks a lot.

I don’t have access to that build history anymore but I’ll post the error, if it does occur again.

Thanks.

Hi @dmeneses
I’ve found the build that had this error and pasted part of it below.

15:43:12 [INFO] [16:43:12.690] Load project referentials…
15:43:12 [WARN] [16:43:12.691] Ability to set quality profile from command line using ‘sonar.profile’ is deprecated and will be dropped in a future SonarQube version. Please configure quality profile used by your project on SonarQube server.
15:43:43 [INFO] [16:43:12.332] Load project referentials done: 642 ms
15:43:43 [INFO] [16:43:12.333] Load project settings
15:43:43 [INFO] [16:43:12.786] Loading technical debit model…
15:43:43 [INFO] [16:43:12.813] Loading technical debt model done: 27ms
15:43:43 [INFO] [16:43:12.816] Apply project exclusions
15:43:14 [ERROR] [16:43:12.157] It looks like an analysis of ‘ProjectName’ is already running (started 19 minutes ago)
15:43:14 [INFO] ----------------------------------------------------------------
15:43:43 [INFO] BUILD FAILURE

Does this help at all?