Bug 606919
Summary: | Memory leak in xenstore | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 5 | Reporter: | Paolo Bonzini <pbonzini> | ||||
Component: | xen | Assignee: | Michal Novotny <minovotn> | ||||
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | ||||
Severity: | urgent | Docs Contact: | |||||
Priority: | urgent | ||||||
Version: | 5.4 | CC: | alexander, areis, chris.lober, hbrock, herrold, iaslanidis, james.brown, jdenemar, juzhang, jwest, llim, minovotn, mjenner, mrezanin, nachandr, plyons, samuel.kielek, slords, tao, virt-maint, xen-maint, yuzhang | ||||
Target Milestone: | rc | Keywords: | ZStream | ||||
Target Release: | --- | ||||||
Hardware: | x86_64 | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | xen-3.0.3-114.el5 | Doc Type: | Bug Fix | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | 590073 | Environment: | |||||
Last Closed: | 2011-01-13 22:22:19 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | 590073 | ||||||
Bug Blocks: | 514499, 593339, 616091 | ||||||
Attachments: |
|
Description
Paolo Bonzini
2010-06-22 18:10:36 UTC
Upstream c/s 21356. (In reply to comment #3) > Upstream c/s 21356. I guess you overlooked something since I'm seeing this as c/s 21353 [1]. But this is OK ;) Michal [1] http://xenbits.xensource.com/staging/xen-unstable.hg?rev/2dd3141b3e3e *** Bug 507545 has been marked as a duplicate of this bug. *** Created attachment 426553 [details]
Patch to fix xenstore leaks
This is the patch to fix the xenstore leaks. Basically it's a backport of upstream c/s 21353. Upstream uses different codebase with the possibility to both use and don't use pthreads but we use pthreads so the macro definitions were substituted by the direct definitions to use pthread_cleanup_push() and pthread_cleanup_pop() macros directly.
Upstream relationship: xen-unstable c/s 21353
Testing: since the leaking is slow I used valgrind for finding the memory leaks, the syntax I used is `valgrind -v --leak-check=full --show-reachable=yes --log-file=file /usr/sbin/libvirtd` to be able to see all the libvirt daemon messages and then I setup libvirt to accept remote connection (although from localhost) not to ignore the libvirt daemon (since `virsh list` was working even though libvirt was not running because it's most likely been accessing xenstore directly but I needed to connect to libvirt daemon first) and I issued many `virsh -c xen+ssh://localhost list` commands when running libvirt on valgrind. After interrupt signal (Ctrl + C) valgrind dumped the data to the file and this is the snippet from the valgrind without the patch applied:
==5045== 1,760 bytes in 44 blocks are definitely lost in loss record 317 of 328
==5045== at 0x4A05E1C: malloc (vg_replace_malloc.c:195)
==5045== by 0x4C3D147: read_message (xs.c:768)
==5045== by 0x4C3D38D: read_thread (xs.c:824)
==5045== by 0x3D3B80673C: start_thread (pthread_create.c:301)
==5045== by 0x3D3ACD3D1C: clone (in /lib64/libc-2.5.so)
With this patch applied, there's no read_message occurrence and no such block could be found which means that xenstore is no longer leaking.
Michal
QA verified this bug on xen-3.0.3-115.el5: 1. Start libvirtd valgrind with the following command: #valgrind -v --leak-check=full --show-reachable=yes --log-file=logfile /usr/sbin/libvirtd 2. Remote connect to libvirtd via virsh for 10 minutes with the following command: #count=0; while [ $count -lt 200 ]; do virsh -c xen+ssh://localhost list; sleep 3; let count=$count+1; done; For xen package without this patch(xen-3.0.3-113.el5), we could find memory leak from the logfile: ==25406== 8,000 bytes in 200 blocks are definitely lost in loss record 291 of 294 ==25406== at 0x4A05E1C: malloc (vg_replace_malloc.c:195) ==25406== by 0x4C299D9: read_message (xs.c:768) ==25406== by 0x4C29B4B: read_thread (xs.c:824) ==25406== by 0x3A61C0673C: start_thread (in /lib64/libpthread-2.5.so) ==25406== by 0x3A610D3D1C: clone (in /lib64/libc-2.5.so) For xen-3.0.3-115.el5, no such memory leak is found. So change this bug to VERIFIED. An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2011-0031.html |