Re: KDevelop cpp file causes DoS on CI nodes

Igor Kushnir <[email protected]> Sun, 22 Jan 2023 12:30:04 +0200
Newsgroups gmane.comp.kde.devel.kdevelop
Message-ID <[email protected]>
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-types/plugins/clang/tests/files/kdev_ignored/mangle-ms-back-references-pr13207.cpp <https://invent.kde.org/kdevelop/kdevelop/-/blob/work/kdev-clang-cache-types/plugins/clang/tests/files/kdev_ignored/mangle-ms-back-references-pr13207.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!

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/

But cppcheck run in the KDevelop project directory locally would still hang, 
because .kde-ci.yml would be ignored then.

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?

Cheers,
Igor