which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
SonarQube Enterprise 9.7.1
sonar-scanner 4.7.2747
what are you trying to achieve
Scan the code with server side caching using the Sonar CFamily scanner.
what have you tried so far to achieve this
I tried to prune some libraries in our Docker, but I accidentally pruned too many, including the Eigen library for example.
This lead to worse analysis results and a lot of ‘file not found’ logs
After using the Docker with all the libraries again, all the unchanged files show a cache hit (server side cache).
The cache hit was generated with the faulty analysis with the file not found. (see log)
I can’t find anywhere where the server side cache can be manually cleared.
If a file is not found this should be part of cache invalidation, so this is a bug in SonarQube server side caching. I.e. SonarQube should check if files that where missing for a cache hit can be found now.
14:07:47.388 INFO: Cache hit for: /some/redacted.cpp
14:07:47.389 DEBUG: [main] /some/redacted.h:18 'Eigen/Core' file not found
thank you for the workaround, I’ll use that for now.
Maybe it would be good to add a -Dsonar.cfamily.clearServerCache=true in the future, so that this can be done properly. As we all know cache invalidation is one of the hardest problems in computer science, and it’s always good to have a manual escape hatch here.
I was able to reproduce and I created this ticket: [CPP-4037] - Jira
Fair point about the option to clear the cache. We added a hidden one to disable the cache in case of a bug but we missed the fact that it isn’t straightforward to clear the server cache.