Skip to content

DAOS-19995 cart: hold a group reference for the RPC lifetime - #19584

Open
frostedcmos wants to merge 5 commits into
masterfrom
frostedcmos/daos-19995
Open

frostedcmos wants to merge 5 commits into
masterfrom
frostedcmos/daos-19995

Conversation

@frostedcmos

Copy link
Copy Markdown
Contributor

crt_corpc_req_create() and the other sites assigning crp_grp_priv take a group reference when the field is set, so it pairs with the decref in crt_rpc_priv_free(). Without that, an RPC can outlive the group it points at: the uri and address lookups on send and the completion path dereference the group after its last external reference is gone.

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).

An RPC stores its group in rpc_priv->crp_grp_priv without taking a
reference, at every site that assigns the field. crt_rpc_priv_free()
releases no group reference either, so the reference the RPC relies on
is the caller's attach reference. Once crt_group_detach() drops that
reference and the count reaches zero, an RPC that is still alive - for
example a request aborted during context teardown whose completion is
processed after the caller has returned - dereferences the freed group
in crt_rpc_priv_free() and in the timeout and completion paths that
read group state.

Take a group reference wherever crp_grp_priv is assigned:
crt_req_create(), crt_req_create_internal() and the collective root
path in crt_corpc_req_create(). Release it in crt_rpc_priv_free().
crt_req_set_endpoint() replaces the group, so release the previous
reference there before taking the new one.

Fixes: DAOS-19995

Signed-off-by: Jihyeon Gim <potatogim@gluesys.com>
Cover the fix that has an RPC hold a reference on its group: rank 0
creates a secondary group, sends an RPC on it, and destroys the
secondary group while the RPC is still in flight, so the completion
and crt_rpc_priv_free() run after the last external reference on the
group is gone. Without the fix this is a use-after-free on
crp_grp_priv.

The test runs two crt_launch instances on one node through the
grp_lifetime avocado test, following the corpc_errors pattern.

Fixes: DAOS-19995

Signed-off-by: Jihyeon Gim <potatogim@gluesys.com>
Format no_pmix_grp_lifetime.c with the repository clang-format
settings, and use the "(C) Copyright <year> <organization>" form in
the two new test files. Add Gluesys to the spelling dictionary so
pylint accepts it in the docstring.

Signed-off-by: Jihyeon Gim <potatogim@gluesys.com>
@daosbuild3

Copy link
Copy Markdown
Collaborator

Test stage Functional Cluster Box Medium Provider MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-19584/1/execution/node/1691/log

Drop the copied host-name comment, use plain keys for the single
hosts and tests variants, and run the test in daily regression
instead of on every PR.

Signed-off-by: Jihyeon Gim <potatogim@gluesys.com>
@potatogim

Copy link
Copy Markdown

Thanks for the review. I applied these in #19526 (5dc4e67): the copied host-name comment is gone, hosts and tests are plain keys now, and the test runs in daily_regression instead of on every PR. The env_D_PROVIDER mux stays because it has two variants, and I kept the hosts_1 and grp_lifetime nesting to match the other cart configs such as rpc/multisend_one_node.yaml.

@github-actions

Copy link
Copy Markdown

Ticket title is 'RPCs can outlive group detach without holding a group reference'
Status is 'Open'
https://daosio.atlassian.net/browse/DAOS-19995

@daosbuild3

Copy link
Copy Markdown
Collaborator

Test stage Functional Hardware Medium Provider MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-19584/2/execution/node/1818/log

@daosbuild3

Copy link
Copy Markdown
Collaborator

Test stage Functional Hardware Large MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-19584/3/execution/node/670/log

@frostedcmos

Copy link
Copy Markdown
Contributor Author

2 unrelated failures due to ""NVMe SSD [0000:87:00.0] not found" on hdr-117

@daltonbohning daltonbohning left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ftest changes LGTM. Will defer to code owners for the C changes

@frostedcmos
frostedcmos requested a review from a team December 2, 2026 16:49
@frostedcmos frostedcmos added the forced-landing The PR has known failures or has intentionally reduced testing, but should still be landed. label Dec 2, 2026

This branch has not been deployed

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

Labels

forced-landing The PR has known failures or has intentionally reduced testing, but should still be landed.

Development

Successfully merging this pull request may close these issues.

6 participants