DAOS-19018 kv: fix reference leak in daos_kv2objhandle()#18412
Conversation
|
Ticket title is 'reference leak in daos_kv2objhandle()' |
|
Test stage NLT completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-18412/1/testReport/ |
|
Test stage Functional on EL 9 completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-18412/1/execution/node/983/log |
a7a8cc6 to
8cca1f6
Compare
|
Test stage Functional on EL 9 completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-18412/4/execution/node/1040/log |
kv_hdl2ptr() increments the dc_kv reference count via daos_hhash_link_lookup(). daos_kv2objhandle() was returning without calling kv_decref(), leaking one reference per call. Add the missing kv_decref() after copying the object handle. Signed-off-by: Cedric Koch-Hofer <cedric.koch-hofer@hpe.com>
…e leak Add kv_obj_handle() to the DAOS_KV_API suite. The test verifies that: - daos_kv2objhandle() returns DAOS_HDL_INVAL for an invalid handle - it returns a valid object handle for a valid KV handle - repeated calls do not accumulate dc_kv references (regression for DAOS-19018) - the KV handle can be cleanly closed after repeated calls When built with ASAN/LeakSanitizer, any leaked dc_kv reference will be reported at process exit. Signed-off-by: Cedric Koch-Hofer <cedric.koch-hofer@hpe.com>
73da934 to
24c8ba7
Compare
|
Apologies for the force push, but I was not able to properly merge as the initial target branch was landed on master. |
Description
kv_hdl2ptr()increments thedc_kvreference count viadaos_hhash_link_lookup(). daos_kv2objhandle()was returning without callingkv_decref(), leaking one reference per call. Add the missingkv_decref()after copying the object handle.Also add a regression test in the
DAOS_KV_APIsuite that callsdaos_kv2objhandle()with both invalid and valid handles, exercises the function repeatedly to surface any leak under ASAN/LeakSanitizer, and verifies the KV handle can be cleanly closed afterwards.Dependency
This PR depends on PR #18423 (DAOS-19017: fix
d_aligned_allocsize constraint violation). Without that fix, ASAN aborts immediately on the misaligned allocation, which prevents it from reaching the leak-detection phase. PR #18423 must be merged first for the ASAN/LeakSanitizer validation below to be reproducible.Validation
Both runs used
daos_test -Kwith filterkv_obj_handle, built withSANITIZERS=address.Without the fix — LeakSanitizer detects the
dc_kvleak:With the fix — no
kv_allocleak, 80 bytes and 1 allocation fewer:The remaining leaks in both runs (openmpi, isal, hwloc) are pre-existing third-party leaks unrelated to this change.
Steps for the author:
After all prior steps are complete: