Application not updating duplication calculation from a project

Enterprise Edition Version 8.3.1 (build 34397)

I have an application that includes many projects. I noticed the duplication calculation was very high and determined one project that has a great deal of generated code was a major contributor. I updated the project to exclude the duplicated code and another build/scan has been executed. I see in the project that the duplication calculation has been updated and greatly reduced, but it is not reflected in the application that includes the project. I’m not sure what I am missing here, maybe something in the application configuration? Here are some screen shots to better explain what I’m seeing:

Here’s the application overview for overall code. Notice the 17% duplication.

Notice if I list the projects, the project at the top with the very high duplication number:

However, if I go to that project itself, you can see the duplication is now quite low. You can also see the trend showing when the change was made and had impact.

Any idea what I’m doing wrong here?

Tom Z

One thing I have noticed on this Application is that it is that there is no Activity since 9-Oct on it. The projects in the Application are updating and other Applications that include some of these projects are updating. Any idea what would cause an Application’s activity to stop? Can I look in a log somewhere?

Hi @tomzudock,

There’s a couple of information I’d like to know to better understand your problem:

  • Did you check the analysis warning?
  • What’s the value of the sonar.portfolios.recompute.hours settings? Go to Administration > Portfolios > Recalculation


@Philippe_Perrin the warning is no longer shown but the activity on the application is still not updating.

The recalculation setting is empty as shown below:

There’s a couple of things that might worth being checked before going further.

  • Can you provide a capture of your application definition? Go to Application settings > Edit definition
    • I’m curious to see if you have any specific branch configuration there
  • Do you see anything relevant in the application background tasks page? Go to Application Settings > Background tasks
    • Any failed tasks?

If you can’t find anything relevant there, I’d suggest to switch the log level of your server to DEBUG and to trigger a manual computation of the application. Logs might help to understand what’s going on. Make sure you switch back to INFO once the application has been recompute.

  • Log level => Go to Administration > System and change the log level to DEBUG.
  • Manual computation of the application => Go to Application settings > Edit definition, then click on Recompute


@Philippe_Perrin, I found how to access logs in the UI. I will recompute and examine them.

Application definition shown below:

This time when I recomputed the application SQ reported this error:

I set logs to debug level to see what I could find in the compute log. I found this related to the rel branch:

2020.11.03 17:17:22 ERROR ce[AXWPHPI7ELK4bM2ave83][o.s.c.t.CeWorkerImpl] Failed to execute task AXWPHPI7ELK4bM2ave83
java.lang.IllegalStateException: Application branch with key 'xxxx_java:BRANCH:rel' doesn't exist

So I deleted the rel branch and clicked recompute. Now I see this:

I recomputed and saw a background task failure:

The background task error log indicated the following:
org.sonar.ce.task.projectanalysis.component.VisitException: Visit failed for Component {key=blah1,type=PROJECT_VIEW} located blah2(type=VIEW)

Caused by: java.lang.UnsupportedOperationException: a measure can be set only once for a specific Component (key=blah1), Metric (key=projects). Use update method

So I removed the blah1 project and now the recompute works. Any idea what that error message means in terms of what is wrong with the blah1 project?

@Philippe_Perrin, I think maybe that project no longer existed or something like that. I was able to add the project back in (may have been a newly created project for that code tree) and I can recompute fine now. Thanks for all the help.

Thanks for the detailed explanations @tomzudock.

Some things still aren’t clear to me. Do you mind giving me more information on your setup/process?

  1. It’s not clear to me whether this error message is mentioning an missing application branch or a missing sub-project branch. Could you clarify?
  1. What was that rel application’s branch about? What was its configuration?
  2. How many failed task are you able to find for your application? Am I asking because I’m wondering why you haven’t seen any warning before? I would expect you to be warn that the automatic computation of the application has failed somehow. You’ll be able to filter the background tasks list by type (Portfolio calculation) and by status (FAILED).


@Philippe_Perrin I don’t know that I will be able to answer all your questions definitively. I have only recently begun using branches on projects and applications.

Regarding #1 above, the application did have a rel branch and many of the projects in that application had their rel branch selected for that application. When I deleted the rel branch on the application, I was able to recompute, which seems counterintuitive to the error, but it defintely resolved the problem of not being able to recompute.

Regarding #2, rel is just an productization “release” branch where some of projects get branched if they have had changes since the last release.

Regarding #3, we were not monitoring failed background tasks and indeed they have been there for awhile. Now that we know to do this, our build engineer is going back through the errors to see what else may still be failing.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.