Project

General

Profile

Bug #6786

`zpool create` never calls sa_fini()

Added by Josef Sipek over 4 years ago. Updated about 3 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Start date:
2016-03-23
Due date:
% Done:

0%

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

Description

zpool create has a minor memory leak. If invoked with sharenfs (and like sharesmb) option, it will end up calling sa_init indirectly through libzfs, but in never ends up calling sa_fini (directly or indirectly) to clean up.

Steps to reproduce:

meili# export UMEM_DEBUG=verbose,default,audit=50
meili# mdb /usr/sbin/zpool 
> ::sysbp _exit
> :r create -O sharenfs=rw testpool /dev/lofi/1
mdb: stop on entry to _exit
mdb: target stopped at:
0xfedf4fd8:     nop    
mdb: You've got symbols!
Loading modules: [ ld.so.1 libumem.so.1 libc.so.1 libtopo.so.1 libavl.so.1 libnvpair.so.1 libsysevent.so.1 libuutil.so.1 ]
> ::findleaks -dv
findleaks:                maximum buffers => 457
findleaks:                 actual buffers => 206
findleaks: 
findleaks:             potential pointers => 242850
findleaks:                     dismissals => 177157        (72.9%)
findleaks:                         misses => 60749         (25.0%)
findleaks:                           dups => 4741          ( 1.9%)
findleaks:                        follows => 203           ( 0.0%)
findleaks: 
findleaks:              peak memory usage => 61 kB
findleaks:               elapsed CPU time => 0.0 seconds
findleaks:              elapsed wall time => 0.0 seconds
findleaks: 
CACHE     LEAKED   BUFCTL CALLER
08dc2590       1 08e784d0 libshare.so.1`proto_plugin_init+0x2a3
08dc2590       1 08e785d0 libshare.so.1`proto_plugin_init+0x2a3
08dc2590       1 08e783d0 libshare.so.1`proto_plugin_init+0x2a3
------------------------------------------------------------------------
   Total       3 buffers, 576 bytes

umem_alloc_192 leak: 1 buffer, 192 bytes
            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS
         8e784d0          8e77e00      37d581a09bc                1
                          8dc2590                0                0
                 libumem.so.1`umem_cache_alloc_debug+0x1fe
                 libumem.so.1`umem_cache_alloc+0x18f
                 libumem.so.1`umem_alloc+0x50
                 libumem.so.1`umem_malloc+0x36
                 0xfe973245
                 0xfe97534c
                 0xfe4f5b5c
                 0xfe4f5c1b
                 0xfe8eb5d5
                 0xfe8eb7c5
                 0xfe8ebb5d
                 0xfe8e888e
                 0xfe8e8a25
                 libshare.so.1`proto_plugin_init+0x2a3
                 libshare.so.1`sa_init+0x51
                 libzfs.so.1`zfs_init_libshare+0x83
                 libzfs.so.1`zfs_valid_proplist+0xb0d
                 libzfs.so.1`zpool_create+0x15d
                 zpool_do_create+0x7ca
                 main+0x12c
                 _start+0x83

umem_alloc_192 leak: 1 buffer, 192 bytes
            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS
         8e785d0          8e77d00      37d581a0e6c                1
                          8dc2590                0                0
                 libumem.so.1`umem_cache_alloc_debug+0x1fe
                 libumem.so.1`umem_cache_alloc+0x18f
                 libumem.so.1`umem_alloc+0x50
                 libumem.so.1`umem_malloc+0x36
                 0xfe973245
                 0xfe97534c
                 0xfe4f5b81           
                 0xfe4f5c1b
                 0xfe8eb5d5
                 0xfe8eb7c5
                 0xfe8ebb5d
                 0xfe8e888e
                 0xfe8e8a25
                 libshare.so.1`proto_plugin_init+0x2a3
                 libshare.so.1`sa_init+0x51
                 libzfs.so.1`zfs_init_libshare+0x83
                 libzfs.so.1`zfs_valid_proplist+0xb0d
                 libzfs.so.1`zpool_create+0x15d
                 zpool_do_create+0x7ca
                 main+0x12c
                 _start+0x83

umem_alloc_192 leak: 1 buffer, 192 bytes
            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS
         8e783d0          8e77f00      37d5819ee71                1
                          8dc2590                0                0
                 libumem.so.1`umem_cache_alloc_debug+0x1fe
                 libumem.so.1`umem_cache_alloc+0x18f
                 libumem.so.1`umem_alloc+0x50
                 libumem.so.1`umem_malloc+0x36
                 0xfe973245
                 0xfe97534c
                 0xfe4f5b3a
                 0xfe4f5c1b
                 0xfe8eb5d5
                 0xfe8eb7c5
                 0xfe8ebb5d
                 0xfe8e888e
                 0xfe8e8a25
                 libshare.so.1`proto_plugin_init+0x2a3
                 libshare.so.1`sa_init+0x51
                 libzfs.so.1`zfs_init_libshare+0x83
                 libzfs.so.1`zfs_valid_proplist+0xb0d
                 libzfs.so.1`zpool_create+0x15d
                 zpool_do_create+0x7ca
                 main+0x12c
                 _start+0x83

History

#1

Updated by Andrew Stormont about 3 years ago

zfs create suffers from the same problem. As far as I can see it's calling sa_fini already so we probably have a memory leak in libshare.

Also available in: Atom PDF