mercury icon indicating copy to clipboard operation
mercury copied to clipboard

NA OFI: Memory leak in _verbs_init_and_alloc_context

Open lokesharo opened this issue 3 years ago • 2 comments

I am using mercury in my application for RPC.

When I exit the application, cleanup of mercury is done as per documentation but I am getting a couple of memory leaks that I am not able to debug and would require help.

==99165==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 648 byte(s) in 1 object(s) allocated from:
    #0 0x7fcccb3ebdc6 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10ddc6)
    #1 0x7fcccb2bb104 in _verbs_init_and_alloc_context (/lib/x86_64-linux-gnu/libibverbs.so.1+0xf104)

Indirect leak of 560 byte(s) in 1 object(s) allocated from:
    #0 0x7fcccb3ebdc6 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10ddc6)
    #1 0x7fcccb2bafa5  (/lib/x86_64-linux-gnu/libibverbs.so.1+0xefa5)
    #2 0x7fcccb2bb11e in _verbs_init_and_alloc_context (/lib/x86_64-linux-gnu/libibverbs.so.1+0xf11e)

SUMMARY: AddressSanitizer: 1208 byte(s) leaked in 2 allocation(s).

I have tried to trace the function but haven't been able to able to trace it back to mercury's code.

According to my tracing: _verbs_init_and_alloc_context is in rdma_core and is invoked by ibv_open_device() present in libibverbs.

I am not able to go past this.

From where does the mercury invoke ibv_open_device() and from where ibv_close_device() is invoked as that will free up the context memory.

Thanks

lokesharo avatar Dec 02 '21 10:12 lokesharo

@missiongoogle apologies for the delay in getting to that. I haven't been able to reproduce it, which version of rdma_core are you using? and which version of libfabric?

soumagne avatar Dec 22 '21 22:12 soumagne

Hello @soumagne, apologies for the late reply.

rdma_core:

ngx@set4sn:~/workdir$ dpkg -s rdma-core | grep '^Version:'
Version: 28.0-1ubuntu1
ngx@set4sn:~/workdir$ 

libfabric: v1.14.0

lokesharo avatar Mar 20 '22 08:03 lokesharo

Please re-open if you still see the issue with recent versions of libfabric and mercury.

soumagne avatar Dec 09 '22 21:12 soumagne