Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-15829 object: fix potential DRAM leak when retry after DTX refresh #14394

Merged
merged 1 commit into from
May 23, 2024

Conversation

Nasf-Fan
Copy link
Contributor

@Nasf-Fan Nasf-Fan commented May 17, 2024

Two possible DRAM leak when re-enter obj_local_rw_internal():

  1. daos_iod_recx_dup() will allocate new iods to replace input one. But the input one may be former daos_iod_recx_dup() allocated.

  2. obj_fetch_csum_init() may allocate new orw_iod_csums arrays that will overwrite former allocated ones.

Some other fixes:

a. obj_fetch_create_maps() may miss new iods when re-enter.

b. obj_prep_fetch_sgls() miss to handle re-enter case.

c. Drop redundant anchor restore for enumeration retry after DTX refresh.

d. Add some log message for the cases that need DTX refresh.

Before requesting gatekeeper:

  • Two review approvals and any prior change requests have been resolved.
  • Testing is complete and all tests passed or there is a reason documented in the PR why it should be force landed and forced-landing tag is set.
  • Features: (or Test-tag*) commit pragma was used or there is a reason documented that there are no appropriate tags for this PR.
  • Commit messages follows the guidelines outlined here.
  • Any tests skipped by the ticket being addressed have been run and passed in the PR.

Gatekeeper:

  • You are the appropriate gatekeeper to be landing the patch.
  • The PR has 2 reviews by people familiar with the code, including appropriate owners.
  • Githooks were used. If not, request that user install them and check copyright dates.
  • Checkpatch issues are resolved. Pay particular attention to ones that will show up on future PRs.
  • All builds have passed. Check non-required builds for any new compiler warnings.
  • Sufficient testing is done. Check feature pragmas and test tags and that tests skipped for the ticket are run and now pass with the changes.
  • If applicable, the PR has addressed any potential version compatibility issues.
  • Check the target branch. If it is master branch, should the PR go to a feature branch? If it is a release branch, does it have merge approval in the JIRA ticket.
  • Extra checks if forced landing is requested
    • Review comments are sufficiently resolved, particularly by prior reviewers that requested changes.
    • No new NLT or valgrind warnings. Check the classic view.
    • Quick-build or Quick-functional is not used.
  • Fix the commit message upon landing. Check the standard here. Edit it to create a single commit. If necessary, ask submitter for a new summary.

Two possible DRAM leak when re-enter obj_local_rw_internal():

1. daos_iod_recx_dup() will allocate new iods to replace input one. But
   the input one may be former daos_iod_recx_dup() allocated.

2. obj_fetch_csum_init() may allocate new orw_iod_csums arrays that may
   overwrite former allocated ones.

Some other fixes:

a. obj_fetch_create_maps() may miss new iods wnen re-enter.

b. obj_prep_fetch_sgls() miss to handle re-enter case.

c. Drop redundant anthor restore for enumeration retry after DTX refresh.

d. Add some log message for the cases that need DTX refresh.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Copy link

github-actions bot commented May 17, 2024

Ticket title is 'soak: 1.5m+ of these messages are occurring while running soak stress "external ERR # [160411.961395] mercury->rpc: [error] /builddir/build/BUILD/mercury-2.3 # hg_core_recv_input_cb(): NA callback returned error (NA_TIMEOUT)"'
Status is 'Open'
Labels: 'soak,triaged'
https://daosio.atlassian.net/browse/DAOS-15829

@Nasf-Fan Nasf-Fan marked this pull request as ready for review May 19, 2024 02:02
@Nasf-Fan Nasf-Fan requested review from a team as code owners May 19, 2024 02:02
@@ -1952,32 +1964,13 @@ obj_local_rw(crt_rpc_t *rpc, struct obj_io_context *ioc, struct dtx_handle *dth)
uint8_t *skips = (uint8_t *)&local_skips;
uint32_t nr = 0;
int rc;
int count = 0;

rc = obj_get_iods_offs(orw->orw_oid, &orw->orw_iod_array, &ioc->ioc_oca,
orw->orw_dkey_hash, ioc->ioc_layout_ver, &iods,
&offs, &skips, &csums, &csum_info, &nr);
Copy link
Contributor

Choose a reason for hiding this comment

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

just confirm why change to do the retry outside obj_local_rw_internal_wrap()?
previously retry inside this func so need not do obj_get_iods_offs() and free the mem for retry, is it with bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because obj_local_rw_internal() may internally allocate some DRAM. If we do not release them before retry, when re-entry obj_local_rw_internal(), it may cause related DRAM leak, such as the iods. It is not impossible to trace them one by one, but it is still possible to miss some corner cases. So here, we introduce obj_local_rw_internal_wrap() that will cleanup obj_local_rw_internal() before re-entry.

anchors[0] = anchors[1];
obj_restore_enum_args(rpc, enum_arg, &saved_arg);
if (opc == DAOS_OBJ_RPC_ENUMERATE)
fill_oid(oei->oei_oid, enum_arg);
Copy link
Contributor

Choose a reason for hiding this comment

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

could you please explain a little bit why above restore section is not needed any more? thx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because vos_iterate() takes anchor parameter, that is both input and output. When vos_iterate() returns for retry, it contains enough information to locate the position for next item. When retry after DTX refresh, it is better to resume from break point (that is the one triggered DTX refresh) instead of from the relative beginning with restore() method.

@Nasf-Fan Nasf-Fan requested a review from gnailzenh May 21, 2024 02:14
@Nasf-Fan Nasf-Fan requested a review from a team May 23, 2024 03:15
@jolivier23 jolivier23 merged commit 8abe5b8 into master May 23, 2024
52 of 53 checks passed
@jolivier23 jolivier23 deleted the Nasf-Fan/DAOS-15829_1 branch May 23, 2024 04:28
Nasf-Fan added a commit that referenced this pull request May 23, 2024
…sh (#14394)

Two possible DRAM leak when re-enter obj_local_rw_internal():

1. daos_iod_recx_dup() will allocate new iods to replace input one. But
   the input one may be former daos_iod_recx_dup() allocated.

2. obj_fetch_csum_init() may allocate new orw_iod_csums arrays that may
   overwrite former allocated ones.

Some other fixes:

a. obj_fetch_create_maps() may miss new iods wnen re-enter.

b. obj_prep_fetch_sgls() miss to handle re-enter case.

c. Drop redundant anthor restore for enumeration retry after DTX refresh.

d. Add some log message for the cases that need DTX refresh.

Signed-off-by: Fan Yong <fan.yong@intel.com>
jolivier23 pushed a commit that referenced this pull request May 24, 2024
…sh (#14394)

Two possible DRAM leak when re-enter obj_local_rw_internal():

1. daos_iod_recx_dup() will allocate new iods to replace input one. But
   the input one may be former daos_iod_recx_dup() allocated.

2. obj_fetch_csum_init() may allocate new orw_iod_csums arrays that may
   overwrite former allocated ones.

Some other fixes:

a. obj_fetch_create_maps() may miss new iods wnen re-enter.

b. obj_prep_fetch_sgls() miss to handle re-enter case.

c. Drop redundant anthor restore for enumeration retry after DTX refresh.

d. Add some log message for the cases that need DTX refresh.

Signed-off-by: Fan Yong <fan.yong@intel.com>
jolivier23 added a commit that referenced this pull request May 25, 2024
…sh (#14394) (#14432)

Two possible DRAM leak when re-enter obj_local_rw_internal():

1. daos_iod_recx_dup() will allocate new iods to replace input one. But
   the input one may be former daos_iod_recx_dup() allocated.

2. obj_fetch_csum_init() may allocate new orw_iod_csums arrays that may
   overwrite former allocated ones.

Some other fixes:

a. obj_fetch_create_maps() may miss new iods wnen re-enter.

b. obj_prep_fetch_sgls() miss to handle re-enter case.

c. Drop redundant anthor restore for enumeration retry after DTX refresh.

d. Add some log message for the cases that need DTX refresh.

Signed-off-by: Fan Yong <fan.yong@intel.com>
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.

4 participants