Project

General

Profile

Bug #5519

zfs-diagnosis: Memory leak in zpool_find_load_time()

Added by Marcel Telka almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
2015-01-09
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

The zpool_find_load_time() function is called on every iteration here in zfs_fm_recv():

661        if (zhdl != NULL &&
662            zpool_iter(zhdl, zpool_find_load_time, &la) == 0 &&
663            la.lt_found == B_TRUE) {

In general, the zpool_iter() allocates new zpool_handle_t and passes it down to the function (zpool_find_load_time() in our case). From this point, the called function is responsible to make sure the zpool_handle_t is released in some point in future by calling zpool_close().

Apparently, the zpool_find_load_time() function usually does not call the zpool_close() on the handle causing the memory leak.

The leak is reproducible using the following steps:

# svccfg -s svc:/system/fmd:default setenv UMEM_DEBUG default
# svcadm refresh svc:/system/fmd:default
# svcadm restart svc:/system/fmd:default
# mkfile 100M /export/test
# zpool create test /export/test
# echo ::findleaks | mdb -p $(pgrep -x fmd)
BYTES             LEAKED VMEM_SEG CALLER
8192                   2 fdf10000 MMAP
4096                   1 fdf96000 MMAP
------------------------------------------------------------------------
           Total       2 oversized leaks, 12288 bytes

CACHE     LEAKED   BUFCTL CALLER
080a1e10       1 092d4108 libnvpair.so.1`nv_alloc_sys+0x1b
080a1e10       1 092d4090 libnvpair.so.1`nv_alloc_sys+0x1b
080a1e10       2 092d2538 libnvpair.so.1`nv_alloc_sys+0x1b
080a1e10      16 092d42e8 libnvpair.so.1`nv_alloc_sys+0x1b
080a1e10       1 092d43d8 libnvpair.so.1`nv_alloc_sys+0x1b
080a1e10       1 092d4360 libnvpair.so.1`nv_alloc_sys+0x1b
080a4210       5 0936b768 libnvpair.so.1`nv_alloc_sys+0x1b
080a4210       5 092cf5a0 libnvpair.so.1`nv_alloc_sys+0x1b
080a4210      24 092d0e90 libnvpair.so.1`nv_alloc_sys+0x1b
080a4410       1 085ee0b8 libnvpair.so.1`nv_alloc_sys+0x1b
080a4410       3 085dde98 libnvpair.so.1`nv_alloc_sys+0x1b
080a4610       6 0881a0f0 libnvpair.so.1`nv_alloc_sys+0x1b
080a4610       9 08848e18 libnvpair.so.1`nv_alloc_sys+0x1b
080a4610       1 0881a168 libnvpair.so.1`nv_alloc_sys+0x1b
080a4810       5 085c0c68 libnvpair.so.1`nv_alloc_sys+0x1b
080a4810       7 085f7588 libnvpair.so.1`nv_alloc_sys+0x1b
080a4810       6 085f4a30 libnvpair.so.1`nv_alloc_sys+0x1b
080a4c10       1 087f5738 libnvpair.so.1`nv_alloc_sys+0x1b
080ac410       1 08178718 libnvpair.so.1`nv_alloc_sys+0x1b
080a7810       1 08e68780 libzfs.so.1`zfs_alloc+0x1e
------------------------------------------------------------------------
   Total      97 buffers, 10000 bytes
#

Related issues

Has duplicate illumos gate - Bug #5207: Memory leak in "zfs-diagnosis" (fmd)Closed2014-10-03

Actions

History

#1

Updated by Marcel Telka almost 6 years ago

  • Status changed from In Progress to Pending RTI
#2

Updated by Electric Monk almost 6 years ago

  • Status changed from Pending RTI to Closed
  • % Done changed from 0 to 100

git commit 69a6f7175eaa5e5a2a38a92e6e522062e898f570

commit  69a6f7175eaa5e5a2a38a92e6e522062e898f570
Author: Marcel Telka <marcel.telka@nexenta.com>
Date:   2015-01-14T15:32:22.000Z

    5519 zfs-diagnosis: Memory leak in zpool_find_load_time()
    Reviewed by: Dan Fields <dan.fields@nexenta.com>
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Serghei Samsi <sscdvp@gmail.com>
    Approved by: Dan McDonald <danmcd@omniti.com>

Also available in: Atom PDF