KDevelop cpp file causes DoS on CI nodes

Milian Wolff mail at milianw.de
Sun Jan 22 13:43:41 GMT 2023


On Sonntag, 22. Januar 2023 11:30:04 CET Igor Kushnir wrote:
> On 2023-01-22 00:17, Ben Cooksley wrote:
> > Hi Milian,
> > 
> > This morning I noticed that 2/3 of our Windows CI nodes were offline, due
> > to them being killed by the OOM killer.
> > 
> > Investigation has traced it back to cppcheck, which appears to have
> > serious
> > problems with the following file currently on a work branch you're working
> > on, with cppcheck using far in excess of 8GB of RAM when trying to
> > process that file (see
> > https://invent.kde.org/kdevelop/kdevelop/-/jobs/722348
> > <https://invent.kde.org/kdevelop/kdevelop/-/jobs/722348>)
> > 
> > The file in question is
> > https://invent.kde.org/kdevelop/kdevelop/-/blob/work/kdev-clang-cache-type
> > s/plugins/clang/tests/files/kdev_ignored/mangle-ms-back-references-pr13207
> > .cpp
> > <https://invent.kde.org/kdevelop/kdevelop/-/blob/work/kdev-clang-cache-ty
> > pes/plugins/clang/tests/files/kdev_ignored/mangle-ms-back-references-pr132
> > 07.cpp>
> > 
> > Can we please get it removed from the repository or otherwise fixed to not
> > trigger this cppcheck bug?
> > Please do not test any fixes for this issue on the CI system - as it will
> > cause the Windows (and even potentially FreeBSD) CI worker nodes to be
> > killed.
> > 
> > Thanks,
> > Ben
> 
> Hi!

Hi Ben,

sorry for the trouble, this was obviously not something we thought about.

> I think we should disable running cppcheck on this test file. Unfortunately
> I couldn't find a way to suppress cppcheck-ing a file without modifying the
> cppcheck command line arguments. A quick and simple workaround that should
> work (haven't tested it yet) is this patch:
>
> diff --git a/.kde-ci.yml b/.kde-ci.yml
> index 4921b8c20d..ed61134ad3 100644
> --- a/.kde-ci.yml
> +++ b/.kde-ci.yml
> @@ -15,3 +15,7 @@ Dependencies:
>   - 'on': ['Linux', 'FreeBSD']
>     'require':
>       'plasma/libksysguard': '@stable'
> +
> +Options:
> +  cppcheck-ignore-files:
> +    - plugins/clang/tests/files/kdev_ignored/

I agree, this would be the ideal solution. 
 
> But cppcheck run in the KDevelop project directory locally would still hang,
> because .kde-ci.yml would be ignored then.

Ce'est la vis. I'm not running cppcheck anyways so I don't care. We could also 
create a utility wrapper in our `developer-scripts` folder that runs it with 
the proper exclusion rules.

> Milian, is this local cppcheck issue a problem? Should we remove the test
> file because of it? Or should we just report the bug to cppcheck upstream
> and keep the test file?

One way or another, this bug should certainly be reported upstream.

Additionally, we could also request an easier way to mark a directory as 
excluded, without having to pass custom command line args. I.e. something 
similar to the `.kdev-ignore` file, but for cppcheck. Or a comment we could 
add at the top of the file in question to make cppcheck return early.

Cheers

-- 
Milian Wolff
http://milianw.de




More information about the KDevelop-devel mailing list