Skip to content

ec: free plugin memory when it destructs and repeated loads#57592

Merged
yuriw merged 2 commits intoceph:mainfrom
Svelar:asan_ec_shec_t
Jul 16, 2024
Merged

ec: free plugin memory when it destructs and repeated loads#57592
yuriw merged 2 commits intoceph:mainfrom
Svelar:asan_ec_shec_t

Conversation

@Svelar
Copy link
Member

@Svelar Svelar commented May 21, 2024

When sanitizer is enabled, unittest_erasure_code_shec_thread shows,

=================================================================
==737674==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1360 byte(s) in 5 object(s) allocated from:
    #0 0xaaaadddffb08 in operator new(unsigned long) (/root/ceph/build/bin/unittest_erasure_code_shec_thread+0x1bfb08) (BuildId: 187a0067c45bf30f4d0bd2df83a32e0127ef03a1)
    https://github.com/ceph/ceph/pull/1 0xffff800bb004 in __erasure_code_init /root/ceph/src/erasure-code/shec/ErasureCodePluginShec.cc:81:36
    https://github.com/ceph/ceph/pull/2 0xaaaadde08de0 in thread1(void*) /root/ceph/src/test/erasure-code/TestErasureCodeShec_thread.cc:100:5
    https://github.com/ceph/ceph/pull/3 0xffff7f45d5c4 in start_thread nptl/./nptl/pthread_create.c:442:8
    https://github.com/ceph/ceph/pull/4 0xffff7f4c5ed8  misc/../sysdeps/unix/sysv/linux/aarch64/clone.S:79

SUMMARY: AddressSanitizer: 1360 byte(s) leaked in 5 allocation(s).

When the plugin destructed, memory should be freed without unloading the
dynamic library. And repeated loading could cause fail, memory should be freed.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@Svelar Svelar requested a review from a team as a code owner May 21, 2024 09:33
@github-actions github-actions bot added the core label May 21, 2024
@Svelar Svelar mentioned this pull request May 23, 2024
14 tasks
@Svelar Svelar marked this pull request as draft May 27, 2024 03:59
@Svelar Svelar force-pushed the asan_ec_shec_t branch 3 times, most recently from 13b281b to 3cdc19a Compare May 28, 2024 02:29
Svelar added 2 commits May 28, 2024 03:01
When sanitizer is enabled, unittest_erasure_code_shec_thread shows,

```
=================================================================
==737674==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1360 byte(s) in 5 object(s) allocated from:
    #0 0xaaaadddffb08 in operator new(unsigned long) (/root/ceph/build/bin/unittest_erasure_code_shec_thread+0x1bfb08) (BuildId: 187a0067c45bf30f4d0bd2df83a32e0127ef03a1)
    #1 0xffff800bb004 in __erasure_code_init /root/ceph/src/erasure-code/shec/ErasureCodePluginShec.cc:81:36
    #2 0xaaaadde08de0 in thread1(void*) /root/ceph/src/test/erasure-code/TestErasureCodeShec_thread.cc:100:5
    #3 0xffff7f45d5c4 in start_thread nptl/./nptl/pthread_create.c:442:8
    #4 0xffff7f4c5ed8  misc/../sysdeps/unix/sysv/linux/aarch64/clone.S:79

SUMMARY: AddressSanitizer: 1360 byte(s) leaked in 5 allocation(s).
```

When the plugin destructed, memory should be freed without unloading the
dynamic library.

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
Repeated loading could cause fail, memory should be freed.

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
@Svelar Svelar marked this pull request as ready for review May 28, 2024 03:33
@Svelar
Copy link
Member Author

Svelar commented May 28, 2024

jenkins test make check arm64

Copy link
Contributor

@tchaikov tchaikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

@yuriw
Copy link
Contributor

yuriw commented Jul 16, 2024

@yuriw yuriw merged commit 130491f into ceph:main Jul 16, 2024
NitzanMordhai pushed a commit to NitzanMordhai/ceph that referenced this pull request Aug 1, 2024
ec: free plugin memory when it destructs and repeated loads

Reviewed-by: Kefu Chai <tchaikov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants