Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

DetektSensor time increased after SonarQube DataCenter version upgrade. #169

Open
EaseTheWorld opened this issue Jul 27, 2023 · 5 comments

Comments

@EaseTheWorld
Copy link

EaseTheWorld commented Jul 27, 2023

Hello, DetektSensor team.
My team has been using Jenkins(running sonar-scanner) - SonarQube DataCenter Edition.
After upgrade SonarQube DataCenter Edition 9.4 -> 9.9,
DetektSensor processing time increased from 2~3min to 2~3hours.

sonar-scanner log is like this(simplified)

|[2023-07-24T12:43:20.195Z] INFO: Sensor DetektSensor [detekt] // A
|[2023-07-24T12:46:26.713Z] complexity - 32d 2h debt
TooManyFunctions, ComplexConditions, blabla, …
[2023-07-24T12:46:29.490Z] Overall debt: 478d 15h 37min
[2023-07-24T12:46:29.490Z] INFO: RuleSet: complexity - 2310
[2023-07-24T12:46:29.490Z] INFO: No file found for // B
[2023-07-24T14:37:44.862Z] INFO: No file found for /project/root/…/schema/s1.kt
No file found for all /schema/….kt
[2023-07-24T14:37:44.862Z] INFO: No file found for /project/root/…/schema/s9.kt
[2023-07-24T14:37:51.418Z] INFO: Sensor DetektSensor [detekt] (done) | time=6871251ms // C

(if I add '/schema/' to detekt path filter in sonar project setting, ’No error found’ error is gone(they are generated code and excluded from coverage), but that’s not the point here. the time doesn’t change.)

A-B part is didn’t change before/after upgrade.
but B-C part is increased significantly. line count is same, only time is increased.

Q1 : It seems in B-C, IssueReporter revisits the issues found from A-B. why revisit?
Q2 : In B-C, is it purely local job? or it communicates with server?
Q3 : Why server upgrade slow down B-C? DetektSensor version has been always 2.5.0.

I’m quite new to sonar ecosystem. Any hint will be appreciated.

@EaseTheWorld EaseTheWorld changed the title DetektSensor time increased after SonarQuve DataCenter versio upgrade. DetektSensor time increased after SonarQube DataCenter versio upgrade. Jul 27, 2023
@ohmerhe
Copy link

ohmerhe commented Jul 28, 2023

Same issue happened to me. Do we have any update?

@arturbosch
Copy link
Member

arturbosch commented Aug 15, 2023

Hm it is caused by this code path:

        val inputFile = fileSystem.inputFile(fileSystem.predicates().`is`(pathOfIssue))
        if (inputFile == null) {
            logger.info("No file found for ${finding.location.filePath.absolutePath}")
            return
        }

We are using the sonar api to find files. it seems like an internal change on sonar's side maybe ?
Do you have any symbolic links or something where the filesystem engine gets confused ?

You could try out https://github.com/detekt/sonar-detekt/releases/tag/2.6.0-RC1 where I set the sonarqube baseline to 9.9 LTS.

@EaseTheWorld
Copy link
Author

EaseTheWorld commented Aug 16, 2023

Hmm. no symbolic link... No source change actually.
"No file found..." error occurred for special specific path. so I excluded them but the slow-scan-issue is still same in 9.9 LTS.

You said 2.6.0 set baseline for 9.9 LTS. Does it mean 2.5.0 had some compatibility issue in 9.9 LTS?

@arturbosch
Copy link
Member

arturbosch commented Aug 17, 2023

Hmm. no symbolic link... No source change actually. "No file found..." error occurred for special specific path. so I excluded them but the slow-scan-issue is still same in 9.9 LTS.

You said 2.6.0 set baseline for 9.9 LTS. Does it mean 2.5.0 had some compatibility issue in 9.9 LTS?

No, no known compatibility issues. I had to fix a regression from #167 but that was never released. Also no deprecations or anything from sonar-api update.
Just some house keeping after two years and set the new minimal version to newest LTS.

how big (LOC) is your project ? Do you also have these performance issues with a 10.X release?
I try to test 9.9 on some bigger projects later.

@EaseTheWorld
Copy link
Author

LOC is about 200K and detected issue count is 100K.
If you see the log in my original post,

  • detection part : duration is not changed before/after upgrade, 3min.
  • issue reporting part : before upgrade : 20min -> after upgrade : 2hours.

My corp has't upgrade to 10.X yet. still 9.9.

@EaseTheWorld EaseTheWorld changed the title DetektSensor time increased after SonarQube DataCenter versio upgrade. DetektSensor time increased after SonarQube DataCenter version upgrade. Aug 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants