Analysis fails due to "LICENSING_LOC" after upgrade to 9.0.1

Hello!

We’re running our analysis in GitHub Actions with self-hosted SonarQube:

  • SonarQube 9.0.1.46107
  • SonarScanner 4.6.2.2472
  • Java 11.0.11 AdoptOpenJDK (64-bit)

A project that used to work started to fail after we upgraded from 8.7 to 9.0

“The last analysis failed because it would have caused your server-wide lines of code total to exceed your 250000 limit.”
This is unexpected as there are still roughly 16k LoC left in the license, the threshold is set to 5k and there have been minimal changes in the repository: between the last working and the first non-working scan, there’s the same number of files being analysed and excluded. Diff to master in the first failing scan is just a few lines: there are no new files or even new lines added.

We have not changed anything in the github actions job or sonar-project.properties, and unnecessary code is excluded as before.
What could be the cause?

In case it matters, the project has only ever analysed PRs. The main branch (or, indeed, any branch) has not been analysed, and the changed lines have been updates to python modules, but we haven’t been able to find anything that they’d have added.

Is there any way to verify how many lines the analysis would have covered? Any help wrt. debugging this would be appreciated.

Hi,
I’m not aware of any change between 8.7 and 9.0 that could impact the count of lines of code.
Is it only happening for one project? What nloc do you see in {server_url}/api/navigation/marketplace?

Hi! 232222 is the number of lines we have currently, meaning we still have ~12k LoC “left” of our license.

We just updated our test instance to 9.1 so now I can use the server logs there to show the number of LoCs also for the failed builds.

  • If I scan the commit that was the last that passed in our prod SQ, the logs show it has 78073 LoC.
  • The next one, the first to fail in prod, had exactly the same, 78073, since there were only a couple of changes to some lines.
  • Even the latest commit (no scans have succeeded after the first one that failed) has 82221

So even at the largest, the difference is only 4148, which is considerably fewer lines than 12k. So this problem really boggles my mind :sweat_smile:

Only branches (not PRs) count for the license. However, when a project is analyzed, the lines being analyzed are included in the calculation.
So I’m thinking that maybe you have 12k LoC left without counting the project being analyzed, since you mentioned that it has no regular branch. When you analyze a PR of that project, the license check sees 232222+78073, which is above 250000.
Maybe when it previously succeeded, the total LOC in SQ was at a point that wouldn’t fail with those additional 78k.