Bug 1733663

Summary: cppcheck killed after memory usage explodes
Product: [Fedora] Fedora Reporter: Scott K Logan <logans>
Component: cppcheckAssignee: Susi Lehtola <susi.lehtola>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: mtasaka, sgrubb, susi.lehtola
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: cppcheck-1.88-3.fc30 cppcheck-1.88-3.fc29 cppcheck-1.88-3.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-06 01:18:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Scott K Logan 2019-07-27 02:48:55 UTC
Description of problem:
cppcheck consumers all of the system's memory and is eventually killed by the kernel.


Version-Release number of selected component (if applicable): cppcheck-1.88-1.fc30.x86_64


How reproducible: 100%



Steps to Reproduce:
1. Create C++ source which requires complex template simplification [1]
2. Run cppcheck on it

Actual results:
From dmesg:
oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/user,task=cppcheck,pid=1585,uid=1000
Out of memory: Killed process 1585 (cppcheck) total-vm:27857440kB, anon-rss:15142504kB, file-rss:4kB, shmem-rss:0kB
oom_reaper: reaped process 1585 (cppcheck), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB


Expected results:
cppcheck does not consume all of my system's memory, and runs to completion.


Additional info:
We first started seeing this manifest as test failures a few days ago on CentOS 7, so the EPEL package is affected as well. Since EPEL doesn't have a separate repository for updates, there isn't an older version to fall back to.

It appears that a fix has been applied for this upstream, but I'm not completely confident I've found the commit with the proper fix, though applying this[2] patch resolves the issue for me, and I haven't observed any other fallout.

Given the potentially destructive nature of consuming all of the system's memory and the release cadence that upstream has taken in the past, I think this bug is worth patching until the next release comes along.

[1] https://github.com/ros2/rclcpp/blob/9aacc6d89523e8fc27769f9b7f31ed97ceec54b1/rclcpp/include/rclcpp/subscription_traits.hpp#L76-L92
[2] https://github.com/danmar/cppcheck/pull/1939

Comment 1 Fedora Update System 2019-07-28 10:02:39 UTC
FEDORA-EPEL-2019-7492840e06 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-7492840e06

Comment 2 Fedora Update System 2019-07-28 10:02:42 UTC
FEDORA-2019-f9f7e46824 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-f9f7e46824

Comment 3 Fedora Update System 2019-07-29 01:14:23 UTC
cppcheck-1.88-3.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-f9f7e46824

Comment 4 Fedora Update System 2019-07-29 04:41:47 UTC
cppcheck-1.88-3.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-a4be77a649

Comment 5 Fedora Update System 2019-07-29 04:49:08 UTC
cppcheck-1.88-3.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-7492840e06

Comment 6 Scott K Logan 2019-07-29 05:11:15 UTC
Thanks for taking action on this.

It appears that I was mistaken that there were no ill-effects from this patch. Even though cppcheck now exits successfully, I noticed the following message in the logs:

[src/ros2/rclcpp/rclcpp/test/test_subscription_traits.cpp:125]: (error) syntax error

I believe that the patch[1] which fixes this issue is also applied upstream. My apologies for not testing more thoroughly before making noise.

[1] https://github.com/danmar/cppcheck/pull/1943

Comment 7 Fedora Update System 2019-08-06 01:18:41 UTC
cppcheck-1.88-3.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2019-08-06 01:55:26 UTC
cppcheck-1.88-3.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2019-08-13 03:07:07 UTC
cppcheck-1.88-3.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.