I have been trying to analyse our C++ source in a large Visual Studio project using the SonarLint extension. However when the analysis runs on Save etc, it fails with the following output
Analyzing C:\devel\my-project\src\Base62Encoding.cpp
WARNING: Timed out after waiting 10000 ms for process C:\USERS\SANTHONISZ\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\16.0_5F098674\EXTENSIONS\BLGS5O1F.XNL\lib\subprocess.exe to complete: it has been terminated, but its child processes may still be running.
It happens every time, both in VS2017 and VS2019, and with the 4.12 and 4.13 versions of the SonarLint extension.
If I create a new simple āConsole Appā project the analysis is working as expected.
How would I go about diagnosing why this is timing-out on the large project - is it simply because it would take longer than the hard-coded 10 second timeout limit?
The size of the project itself is not a big issue for sonarlint :sonarlint:, since the analysis is performed file by file. So to understand the issue, we need to have better information about Base62Encoding.cpp. If you put just this file in the basic console application, do you have the same issue? If so, can you provide us with this project, so that we can try to reproduce this issue?
Do you work with recent&powerful hardware? How long does it take for the file to compile on your environment?
Is the file containing tricky code, such as template metaprogramming or advanced use of constexpr which could make it inherently slow to process?
Iāve done a bit more troubleshooting and it seems to be that the cause of the timeout is the amount of time it takes to parse the headers included via our pre-compiled header file i.e. stdafx.h. There doesnāt seem to be any single header file that is causing the timeout, rather it is just the sheer volume of header files that need to be processed. Our projects typically leverage pre-compiled headers extensively, and they are very large due to the complex dependency treeās of our projects (potentially up to 100 projects).
Do you have any ideas and/or suggestions as to how SonarLint can be used in such a case. Refactoring our code obviously isnāt an option, but the overhead of having to re-analyze the stdafx.h every time a cpp file that uses it is saved just wont work in the context of the 10 second timeout.
The next version of SonarLint will contain an option to tune the value of the timeout for testing purposes. Iāll keep you informed so that you can try it and see if a larger value can solve your issue.
FYI SLVS v4.14 was released a few days ago and supports the environment variable SONAR_CFAMILY_TIMEOUT_MS that you can set for testing purposes. The environment variable should be set before starting VS. Let us know how you get on.
Thanks for the update. I tried v4.14 and set the environment variable, but it was still timing out after 10 seconds. I then had a quick look at the source and discovered you had renamed the environment variable to SONAR_INTERNAL_CFAMILY_ANALYSIS_TIMEOUT_MS (https://github.com/SonarSource/sonarlint-visualstudio/commit/9febe92e6f2090e8abbeee4bb660795f3cdc6a1e). I used that instead and the analysis is now working perfectly! Ironically the file that I reported the original issue on takes about 12 seconds to analyse, so it didnāt need much more time to complete.
Hi @santhonisz, just a heads up ā weāve just released SLVS 4.23 and weāve renamed the environment variable. However, weāve also increased the timeout to 60 seconds and done performance improvements to the analyzer, so the settings this environment variable should not be needed.