7.4.4-1ubuntu2.1 makes rsyslogd to take all the CPU in OpenVZ

Bug #1366829 reported by Patrice
46
This bug affects 7 people
Affects Status Importance Assigned to Milestone
rsyslog (Ubuntu)
Fix Released
High
Brian Murray
Trusty
Fix Released
High
Brian Murray
Utopic
Fix Released
High
Brian Murray

Bug Description

Test Case
---------
* Install rsyslog 7.4.4-1ubuntu2.1 on an Ubuntu system that runs inside an OpenVZ container (If necessary, use ProxMox to quickly establish an OpenVZ container environment)
* Verify that '$KLogPermitNonKernelFacility on' is set in /etc/rsyslog.conf
* Restart rsyslog to make sure any changes to the binaries/config are picked up
* Run 'top' and observe that the rsyslogd process is running at 100% CPU. When working properly, the rsyslogd process should generally be idle.

---------------------------------------------------------------------

After updating rsyslog from 7.4.4-1ubuntu2 to 7.4.4-1ubuntu2.1 the rsyslogd process started to take all the CPU on my machine.
The modification made by this release is described in #1274444, it is the activation of KLogPermitNonKernelFacility option.
I don't know exactly the effect of this option but it seems to have a permanent effect : even after downgrading the package or manually removing the option from /etc/rsyslog.conf the issue remains.
My syslog is full of :
Sep 8 10:28:40 sentry rsyslogd: imklog: error reading kernel log - shutting down: Bad file descriptor
Sep 8 10:28:40 sentry rsyslogd: message repeated 498 times: [imklog: error reading kernel log - shutting down: Bad file descriptor]
Sep 8 10:28:46 sentry rsyslogd-2177: rsyslogd[internal_messages]: 519517 messages lost due to rate-limiting
I guess this is what causes the CPU load.

I am running Ubuntu 14.04.1 LTS in an OpenVZ container on Proxmox 3.2. The kernel is 2.6.32-28-pve
---
ApportVersion: 2.14.1-0ubuntu3.3
Architecture: amd64DistroRelease: Ubuntu 14.04
Package: rsyslog 7.4.4-1ubuntu2.1
PackageArchitecture: amd64
Tags: trusty
Uname: Linux 2.6.32-28-pve x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups:

_MarkForUpload: True

Revision history for this message
Brad Figg (brad-figg) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 1366829

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Steve Langasek (vorlon)
affects: linux (Ubuntu) → rsyslog (Ubuntu)
Changed in rsyslog (Ubuntu):
status: Incomplete → New
Revision history for this message
Chris J Arges (arges) wrote : Re: Updating to rsyslog - 7.4.4-1ubuntu2.1 makes rsyslogd to take all the CPU
Revision history for this message
Chris J Arges (arges) wrote :

@Patrice:
Running 'apport-collect 1366829' as mentioned above would help to debug the issue. Please do so when you get a chance.
Thanks,

The commit that fixes the debian issue above is:
https://github.com/rsyslog/rsyslog/commit/ff091b7ea963b63130cfb77af57f137e632bf765
However, I'm unsure if this is the same issue.

Revision history for this message
Patrice (patrice-g) wrote : Dependencies.txt

apport information

tags: added: apport-collected trusty
description: updated
Revision history for this message
Patrice (patrice-g) wrote : ProcEnviron.txt

apport information

Patrice (patrice-g)
description: updated
Revision history for this message
Siri Vias Singh Khalsa (sirivias) wrote : Re: Updating to rsyslog - 7.4.4-1ubuntu2.1 makes rsyslogd to take all the CPU

I saw the same issue rolling out a new VM using 14.04.1
I was able to resolve the issue by commenting out this line in rsyslog.conf:

#$ModLoad imklog # provides kernel logging support

log example: (repeated millions of times)

Sep 17 00:15:43 mi2 rsyslogd: message repeated 498 times: [imklog: error reading kernel log - shutting down: Bad file descriptor]
Sep 17 00:15:49 mi2 rsyslogd-2177: rsyslogd[internal_messages]: 4572709 messages lost due to rate-limiting
Sep 17 00:15:49 mi2 rsyslogd: imklog: error reading kernel log - shutting down: Bad file descriptor
Sep 17 00:15:49 mi2 rsyslogd: message repeated 498 times: [imklog: error reading kernel log - shutting down: Bad file descriptor]
Sep 17 00:15:55 mi2 rsyslogd-2177: rsyslogd[internal_messages]: 4692976 messages lost due to rate-limiting
Sep 17 00:15:55 mi2 rsyslogd: imklog: error reading kernel log - shutting down: Bad file descriptor

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in rsyslog (Ubuntu):
status: New → Confirmed
Revision history for this message
Paul Donohue (s-launchpad-paulsd-com) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Upstream fix" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
summary: - Updating to rsyslog - 7.4.4-1ubuntu2.1 makes rsyslogd to take all the
- CPU
+ 7.4.4-1ubuntu2.1 makes rsyslogd to take all the CPU in OpenVZ
Changed in rsyslog (Ubuntu):
importance: Undecided → High
Revision history for this message
Brian Murray (brian-murray) wrote :

I'm happy to upload this fix to Trusty and Utopic but we will need a test case in the bug description so that the fix can be verified. Could somebody please provide one following the example at http://wiki.ubuntu.com/StableReleaseUpdates? Thanks!

Changed in rsyslog (Ubuntu):
status: Confirmed → In Progress
assignee: nobody → Brian Murray (brian-murray)
Changed in rsyslog (Ubuntu Trusty):
importance: Undecided → High
Changed in rsyslog (Ubuntu Utopic):
importance: Undecided → High
Changed in rsyslog (Ubuntu Trusty):
status: New → Triaged
Changed in rsyslog (Ubuntu Utopic):
status: New → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package rsyslog - 7.4.4-1ubuntu13

---------------
rsyslog (7.4.4-1ubuntu13) vivid; urgency=medium

  * Applied upstream patch fixing infinite loop on OpenVZ VMs. Thanks to Paul
    Donohue for the patch. (LP: #1366829)
 -- Brian Murray <email address hidden> Thu, 18 Dec 2014 15:20:23 -0800

Changed in rsyslog (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Paul Donohue (s-launchpad-paulsd-com) wrote :

Test case:
* Install rsyslog 7.4.4-1ubuntu2.1 on an Ubuntu system that runs inside an OpenVZ container (If necessary, use ProxMox to quickly establish an OpenVZ container environment)
* Verify that '$KLogPermitNonKernelFacility on' is set in /etc/rsyslog.conf
* Restart rsyslog to make sure any changes to the binaries/config are picked up
* Run 'top' and observe that the rsyslogd process is running at 100% CPU. When working properly, the rsyslogd process should generally be idle.

Revision history for this message
Brian Murray (brian-murray) wrote :

I've uploaded fixes to the SRU queue for Trusty and Utopic, thanks!

Changed in rsyslog (Ubuntu Trusty):
status: Triaged → In Progress
assignee: nobody → Brian Murray (brian-murray)
Changed in rsyslog (Ubuntu Utopic):
status: Triaged → In Progress
assignee: nobody → Brian Murray (brian-murray)
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Patrice, or anyone else affected,

Accepted rsyslog into utopic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/rsyslog/7.4.4-1ubuntu11.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in rsyslog (Ubuntu Utopic):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Patrice, or anyone else affected,

Accepted rsyslog into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/rsyslog/7.4.4-1ubuntu2.4 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in rsyslog (Ubuntu Trusty):
status: In Progress → Fix Committed
Revision history for this message
Simon Déziel (sdeziel) wrote :

Just tested with an existing Trusty VZ and rsyslog (7.4.4-1ubuntu2.4) keeps taking ~100% CPU. I had to re-enable the previous workaround of disabling the imklog module loading.

The host is a 64bit Precise KVM running the OpenVZ upstream kernel from their apt repo: 2.6.32-openvz-042stab102.8-amd64

tags: added: verification-failed
removed: verification-needed
Revision history for this message
Paul Donohue (s-launchpad-paulsd-com) wrote :

Sorry, there were two issues:
1) The condition that the fix was testing for (EBADF on read before dropping privileges) was not a reliable indicator of the underlying problem. I should really have tested for EPERM on read after dropping privileges.
2) I only applied the fix to imkmsg, it also needed to be applied to imklog.

I've submitted an new pull request upstream:
https://github.com/rsyslog/rsyslog/pull/138

Revision history for this message
Paul Donohue (s-launchpad-paulsd-com) wrote :

Oops, wrong url for the new pull request upstream. It is:
https://github.com/rsyslog/rsyslog/pull/198

Revision history for this message
Paul Donohue (s-launchpad-paulsd-com) wrote :

Pull request has been accepted upstream.

Since there are now a bunch of upstream commits involved in the complete fix, I'm attaching an updated 11-fix-infinite-loop-openvz-vms.patch file for the ubuntu packages which contains all the necessary changes.

I also posted updated ubuntu package branches here: https://code.launchpad.net/~s-launchpad-paulsd-com/rsyslog/
But feel free to ignore my branch merge requests if you would prefer to update the package branches yourself.

Revision history for this message
Brian Murray (brian-murray) wrote :

I've uploaded the updated patch from comment #21 to the utopic and trusty proposed queues for review by the SRU team.

Revision history for this message
Brian Murray (brian-murray) wrote :

Oh the vivid task wasn't closed again because it was already closed.

rsyslog (7.4.4-1ubuntu14) vivid; urgency=medium

  * Applied updated upstream patch fixing infinite loop on OpenVZ VMs.
    (LP: #1366829)
 -- Paul Donohue <> Fri, 09 Jan 2015 10:50:36 -0500

Mathew Hodson (mhodson)
tags: added: amd64
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Patrice, or anyone else affected,

Accepted rsyslog into utopic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/rsyslog/7.4.4-1ubuntu11.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: removed: verification-failed
tags: added: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Patrice, or anyone else affected,

Accepted rsyslog into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/rsyslog/7.4.4-1ubuntu2.5 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Revision history for this message
Simon Déziel (sdeziel) wrote :

Great work Paul, thanks!

tags: added: verification-done
removed: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote :

@Simon - Did you verify it on both release that the fix is pending for or only one of them? If only one, which one?

Revision history for this message
Simon Déziel (sdeziel) wrote :

Oh right, I could verify the fix on Trusty.

tags: added: verification-done-precise verification-needed
removed: verification-done
Revision history for this message
Simon Déziel (sdeziel) wrote :

You convinced me to test it on Utopic too. So I verified it on Trusty and Utopic and marked the bug as verified-done. I dropped the verification-done-precise as so far this SRU didn't target Precise.

tags: added: verification-done
removed: verification-done-precise verification-needed
Revision history for this message
Paul Donohue (s-launchpad-paulsd-com) wrote :

I have also verified the fix on Trusty.

Revision history for this message
Patrice (patrice-g) wrote :

Hello,

I have just installed rsyslog version 7.4.4-1ubuntu2.5 in the OpenVZ container where rsyslogd were taking all CPU and I confirm that after the update it was not the case anymore.
Thanks everyone for fixing this issue!

Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for rsyslog has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package rsyslog - 7.4.4-1ubuntu11.2

---------------
rsyslog (7.4.4-1ubuntu11.2) utopic; urgency=medium

  * Applied updated upstream patch fixing infinite loop on OpenVZ VMs.
    (LP: #1366829)
 -- Paul Donohue <email address hidden> Fri, 09 Jan 2015 10:50:36 -0500

Changed in rsyslog (Ubuntu Utopic):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package rsyslog - 7.4.4-1ubuntu2.5

---------------
rsyslog (7.4.4-1ubuntu2.5) trusty; urgency=medium

  * Applied updated upstream patch fixing infinite loop on OpenVZ VMs.
    (LP: #1366829)
 -- Paul Donohue <email address hidden> Fri, 09 Jan 2015 10:50:36 -0500

Changed in rsyslog (Ubuntu Trusty):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.