Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak when running spdk/test/nvme/overhead/overhead with asan #393

Closed
xuhuagen opened this issue Aug 8, 2018 · 2 comments
Closed
Assignees
Labels

Comments

@xuhuagen
Copy link
Contributor

xuhuagen commented Aug 8, 2018

I run script test/nvme/nvme.sh and memory leak occur when running test/nvme/overhead/overhead

the log as below:

==13640==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 8768 byte(s) in 8 object(s) allocated from:
    #0 0x7ffff6efea38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38)
    #1 0x408416 in register_ns /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:140
    #2 0x408416 in register_ctrlr /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:185
    #3 0x408416 in attach_cb /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:609

Direct leak of 8320 byte(s) in 8 object(s) allocated from:
    #0 0x7ffff6efe850 in malloc (/lib64/libasan.so.4+0xde850)
    #1 0x4082bb in register_ctrlr /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:165
    #2 0x4082bb in attach_cb /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:609

Indirect leak of 475136 byte(s) in 8 object(s) allocated from:
    #0 0x7ffff6efea38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38)
    #1 0x4085c4 in spdk_histogram_data_alloc_sized /home/xuhuagen/spdk/include/spdk/histogram_data.h:217
    #2 0x4085c4 in spdk_histogram_data_alloc /home/xuhuagen/spdk/include/spdk/histogram_data.h:229
    #3 0x4085c4 in register_ns /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:154
    #4 0x4085c4 in register_ctrlr /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:185
    #5 0x4085c4 in attach_cb /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:609

Indirect leak of 475136 byte(s) in 8 object(s) allocated from:
    #0 0x7ffff6efea38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38)
    #1 0x40852c in spdk_histogram_data_alloc_sized /home/xuhuagen/spdk/include/spdk/histogram_data.h:217
    #2 0x40852c in spdk_histogram_data_alloc /home/xuhuagen/spdk/include/spdk/histogram_data.h:229
    #3 0x40852c in register_ns /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:153
    #4 0x40852c in register_ctrlr /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:185
    #5 0x40852c in attach_cb /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:609

Indirect leak of 128 byte(s) in 8 object(s) allocated from:
    #0 0x7ffff6efea38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38)
    #1 0x408582 in spdk_histogram_data_alloc_sized /home/xuhuagen/spdk/include/spdk/histogram_data.h:211
    #2 0x408582 in spdk_histogram_data_alloc /home/xuhuagen/spdk/include/spdk/histogram_data.h:229
    #3 0x408582 in register_ns /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:154
    #4 0x408582 in register_ctrlr /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:185
    #5 0x408582 in attach_cb /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:609

Indirect leak of 128 byte(s) in 8 object(s) allocated from:
    #0 0x7ffff6efea38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38)
    #1 0x4084ed in spdk_histogram_data_alloc_sized /home/xuhuagen/spdk/include/spdk/histogram_data.h:211
    #2 0x4084ed in spdk_histogram_data_alloc /home/xuhuagen/spdk/include/spdk/histogram_data.h:229
    #3 0x4084ed in register_ns /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:153
    #4 0x4084ed in register_ctrlr /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:185
    #5 0x4084ed in attach_cb /home/xuhuagen/spdk/test/nvme/overhead/overhead.c:609

SUMMARY: AddressSanitizer: 967616 byte(s) leaked in 48 allocation(s).

Current Behavior

ASAN mem leak when running spdk/test/nvme/overhead/overhead

Possible Solution

Steps to Reproduce

  1. cd /path/to/spdk
  2. ./configure --with-rdma --enable-asan
  3. make clean && make -j
    4../test/nvme/nvme.sh

Context (Environment including OS version, SPDK version, etc.)

Target machine:
OS: Fedora release 27
SPDK version: 2b3abb2

@wanghailiangx
Copy link
Contributor

The memory is not completely released, there are mutiple malloc list, but only the last one is released. So I free all.
I submit a patch to fix it. https://review.gerrithub.io/#/c/spdk/spdk/+/422682/.

@xuhuagen
Copy link
Contributor Author

@wanghailiangx I patched https://review.gerrithub.io/#/c/spdk/spdk/+/422682/, the memory leak occured in overhead.c is not reproduce.

jimharris pushed a commit that referenced this issue Aug 21, 2018
Fix issue #393.
The memory is not completely released, there are mutiple malloc
list, but only the last one is released. So I free all.

Change-Id: I14a583871811b54017728b6a7e92982cd75bd6b1
Signed-off-by: WangHaiLiang <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/422682
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants