Skip to content

Commit

Permalink
tools/ceph-dencoder: unregister dencoders in dtor
Browse files Browse the repository at this point in the history
we have leak reports from ASan like

```
Direct leak of 512 byte(s) in 1 object(s) allocated from:
    #0 0x557c5ca1aa88 in __interceptor_calloc (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/ceph-dencoder+0xc0a88) (BuildId: 0431ba72332bcadbbda97c424e0d5e66a10e88d7)
    #1 0x7f3093a4e7e5  (<unknown module>)

Direct leak of 464 byte(s) in 1 object(s) allocated from:
    #0 0x557c5ca1aa88 in __interceptor_calloc (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/ceph-dencoder+0xc0a88) (BuildId: 0431ba72332bcadbbda97c424e0d5e66a10e88d7)
    #1 0x7f3093a5de3e  (<unknown module>)

Direct leak of 248 byte(s) in 1 object(s) allocated from:
    #0 0x557c5ca1aa88 in __interceptor_calloc (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/ceph-dencoder+0xc0a88) (BuildId: 0431ba72332bcadbbda97c424e0d5e66a10e88d7)
    #1 0x7f30939e05a9  (<unknown module>)

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x557c5ca5566d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/ceph-dencoder+0xfb66d) (BuildId: 0431ba72332bcadbbda97c424e0d5e66a10e88d7)
    #1 0x7f3094c27087  (<unknown module>)
    ceph#2 0x7f3094c21d64  (<unknown module>)
    ceph#3 0x557c5ca680bb in DencoderPlugin::register_dencoders[abi:cxx11]() /home/jenkins-build/build/workspace/ceph-pull-requests/src/tools/ceph-dencoder/denc_plugin.h:44:5
    ceph#4 0x557c5ca5f9ea in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/tools/ceph-dencoder/ceph_dencoder.cc:100:38
    ceph#5 0x7f309f33ad8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x557c5ca5566d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/ceph-dencoder+0xfb66d) (BuildId: 0431ba72332bcadbbda97c424e0d5e66a10e88d7)
    #1 0x7f308c91f257  (<unknown module>)
    ceph#2 0x7f308c8fd0df  (<unknown module>)
    ceph#3 0x557c5ca680bb in DencoderPlugin::register_dencoders[abi:cxx11]() /home/jenkins-build/build/workspace/ceph-pull-requests/src/tools/ceph-dencoder/denc_plugin.h:44:5
    ceph#4 0x557c5ca5f9ea in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/tools/ceph-dencoder/ceph_dencoder.cc:100:38
    ceph#5 0x7f309f33ad8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
```

it turns out the dencoders allocated by `register_dencoders()` are
never unregistered, so let's do the proper cleanup when done
with the dencoders.

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed May 13, 2024
1 parent 3bee77f commit 1e80b6b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/tools/ceph-dencoder/denc_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class DencoderPlugin {
other.dencoders.clear();
}
~DencoderPlugin() {
unregister_dencoders();
#if !defined(__FreeBSD__)
if (mod) {
dlclose(mod);
Expand Down

0 comments on commit 1e80b6b

Please sign in to comment.