[RFC] multipathd: memory leak from orphan_path()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I checked the memory consuming of the multipathd and found it consumes too much memory.
Following is the result I have got from 6 servers.
Longer running multipathd consumes more memory.

# ps -eo user,pid,ppid,rss,size,vsize,pmem,pcpu,time,cmd --sort -rss | grep multipath
root      2948     1  4376 66764  98572  0.0  0.0 00:00:01 /sbin/multipathd
root      3035     1  8648 71068 102876  0.0  0.1 00:09:11 /sbin/multipathd
root     39004     1 10236 137944 169752  0.0 0.1 03:20:43 /sbin/multipathd
root      3149     1 11976 139792 171600  0.0 0.2 05:37:37 /sbin/multipathd
root      3168     1 13792 76056 107864  0.0  0.3 07:04:41 /sbin/multipathd
root      3135     1 14920 142500 174308  0.0 0.4 08:49:38 /sbin/multipathd


So I did valgrind test with debian 0.4.9 version and I've got following error.
pp->getuid is initialized by malloc but it is not freed.

==14958== 280 bytes in 4 blocks are definitely lost in loss record 2 of 3
==14958==    at 0x4C28C20: malloc (vg_replace_malloc.c:296)
==14958==    by 0x5702D2E: select_getuid (in /lib/libmultipath.so.0)
==14958==    by 0x56FFA0F: ??? (in /lib/libmultipath.so.0)
==14958==    by 0x5701707: pathinfo (in /lib/libmultipath.so.0)
==14958==    by 0x5701BDE: store_pathinfo (in /lib/libmultipath.so.0)
==14958==    by 0x5701F17: path_discovery (in /lib/libmultipath.so.0)
==14958==    by 0x407916: configure (main.c:1310)
==14958==    by 0x404B60: child (main.c:1623)
==14958==    by 0x404B60: main (main.c:1834)


Finally I've applied following patch.
The valgrind does not complain any more.
I checked the latest source but orphan_path() has no patch like that.
I'd appreciate if you would review my patch and give me any feedback.


------------------------- 8< ------------------
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 6d2d45e..007b5eb 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -84,6 +84,8 @@ orphan_path (struct path * pp, const char *reason)
        pp->mpp = NULL;
        pp->dmstate = PSTATE_UNDEF;
        pp->uid_attribute = NULL;
+    if (pp->getuid)
+        free(pp->getuid);
        pp->getuid = NULL;
        prio_put(&pp->prio);
        checker_put(&pp->checker);
--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux