Timeout issue with SonarLint

Hi there,

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?

Thanks,

Sam

Hello @santhonisz,

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?

Thank you,

Loïc

1 Like

Thanks for your reply Loïc,

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.

Thanks,

Sam

1 Like

Hello @santhonisz,

Unfortunately, I don’t see anything that can be done from your side, apart from the refactoring you mentioned, which would be a large effort.

I’m looking what can be done on our side. I’ll come back to you when I’ve been able to synchronize with some colleagues.

Thank you,

Loïc

Hello @santhonisz,

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.

Thank you,

Loïc