Skip to content

DAOS-19018 kv: fix reference leak in daos_kv2objhandle()#18412

Draft
knard38 wants to merge 1 commit into
masterfrom
ckochhof/fix/master/daos-19018/patch-001
Draft

DAOS-19018 kv: fix reference leak in daos_kv2objhandle()#18412
knard38 wants to merge 1 commit into
masterfrom
ckochhof/fix/master/daos-19018/patch-001

Conversation

@knard38
Copy link
Copy Markdown
Contributor

@knard38 knard38 commented Jun 3, 2026

Description

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.

Also add a regression test in the DAOS_KV_API suite that calls daos_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.

Steps for the author:

  • Commit message follows the guidelines.
  • Appropriate Features or Test-tag pragmas were used.
  • Appropriate Functional Test Stages were run.
  • At least two positive code reviews including at least one code owner from each category referenced in the PR.
  • Testing is complete. If necessary, forced-landing label added and a reason added in a comment.

After all prior steps are complete:

  • Gatekeeper requested (daos-gatekeeper added as a reviewer).

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.

Also add a regression test in the DAOS_KV_API suite that calls
daos_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.

Signed-off-by: Cedric Koch-Hofer <cedric.koch-hofer@hpe.com>
@knard38 knard38 self-assigned this Jun 3, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

Ticket title is 'reference leak in daos_kv2objhandle()'
Status is 'In Progress'
Labels: 'asan'
https://daosio.atlassian.net/browse/DAOS-19018

@daosbuild3
Copy link
Copy Markdown
Collaborator

@daosbuild3
Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants