RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 885993 - Memory leak in _parse_mirror_status
Summary: Memory leak in _parse_mirror_status
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Zdenek Kabelac
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On:
Blocks: 888457
TreeView+ depends on / blocked
 
Reported: 2012-12-11 09:28 UTC by Zdenek Kabelac
Modified: 2013-02-21 08:15 UTC (History)
11 users (show)

Fixed In Version: lvm2-2.02.98-5.el6
Doc Type: Bug Fix
Doc Text:
Testing of mirror health status caused minor memory leak. Fix is releasing all resources taken in the function and should not cause any memory leaks for longterm living processes like dmeventd.
Clone Of:
Environment:
Last Closed: 2013-02-21 08:15:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0501 0 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2013-02-20 21:30:45 UTC

Description Zdenek Kabelac 2012-12-11 09:28:56 UTC
Description of problem:

Running 2 lvcreate mirror commands lead to internal memory leak,
in the function _parse_mirror_status, where device is tested for
usability. Allocated log and image strings are not released
after their use.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Zdenek Kabelac 2012-12-11 09:32:34 UTC
For testing the only way how to detect this leak is to use valgrind and run 2 commands like    'lvcreate -m2 -L10M vg'

Current code results in leak like:

 16544== 7 bytes in 1 blocks are indirectly lost in loss record 3 of 5
 16544==    at 0x4C2C87C: malloc (vg_replace_malloc.c:270)
 16544==    by 0x5BBAFC1: strdup (strdup.c:42)
 16544==    by 0x483498: dev_create_file (dev-cache.c:84)
 16544==    by 0x53106D: _ignore_blocked_mirror_devices (dev_manager.c:257)
 16544==    by 0x531B1E: device_is_usable (dev_manager.c:359)
 16544==    by 0x492024: _lookup_p (filter-persistent.c:297)
 16544==    by 0x48791B: dev_iter_get (dev-cache.c:1009)
 16544==    by 0x47324E: lvmcache_label_scan (lvmcache.c:692)
 16544==    by 0x4E120F: _vg_read (metadata.c:2981)
 16544==    by 0x4E3407: vg_read_internal (metadata.c:3397)
 16544==    by 0x4E5E3C: _vg_lock_and_read (metadata.c:4033)
 16544==    by 0x4E65D7: vg_read (metadata.c:4137)
 16544==    by 0x4E6633: vg_read_for_update (metadata.c:4148)
 16544==    by 0x42DE9D: lvcreate (lvcreate.c:1028)
 16544==    by 0x4364CE: lvm_run_command (lvmcmdline.c:1120)
 16544==    by 0x43867F: lvm2_main (lvmcmdline.c:1554)
 16544==    by 0x4679C1: main (lvm.c:21)

Comment 2 Zdenek Kabelac 2012-12-11 10:33:29 UTC
Fixed by upstream patch:

https://www.redhat.com/archives/lvm-devel/2012-December/msg00018.html

Comment 4 Zdenek Kabelac 2012-12-11 11:14:51 UTC
While the leak does not look huge, it is in the range of hundred bytes per command and per mirror, we have long-term running commands like  dmeventd which should not leak memory, since the memory may accumulate over the time, and such memory is non-swappable and permanently locked in RAM - so leaving such leak may increase risk of getting OOM killer in action - so setting exception because of this risk.

Comment 5 Nenad Peric 2012-12-11 11:43:22 UTC
Adding QA ACK as SanityOnly since no easy reproducer (in a normal amount of given time) is viable. 
(it would probably accumulate in time as stated in Comment #4, but SanityOnly should suffice in this case I believe)

Comment 7 errata-xmlrpc 2013-02-21 08:15:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0501.html


Note You need to log in before you can comment on or make changes to this bug.