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-6808 rpc: fix memleak in MGMT_TGT_CREATE corpc #5037

Merged
merged 2 commits into from
Mar 21, 2021
Merged

Conversation

liuxuezhao
Copy link
Contributor

  1. provide co_post_reply to free memory
  2. change corpc to not call co_post_reply on root node.

Signed-off-by: Xuezhao Liu xuezhao.liu@intel.com

1. provide co_post_reply to free memory
2. change corpc to not call co_post_reply on root node.

Signed-off-by: Xuezhao Liu <xuezhao.liu@intel.com>
Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

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

LGTM. No errors found by checkpatch.

@liuxuezhao liuxuezhao requested a review from gnailzenh March 16, 2021 15:14
RPC_ADDREF(parent_rpc_priv);
crt_corpc_complete(parent_rpc_priv);

if (co_ops && co_ops->co_post_reply)
am_root = (co_info->co_grp_priv->gp_self ==
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we call this callback for all (not only NONE root)? Maybe move all free in single place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the problem is that when call co_post_reply, in corpc code here it does not know whether or not user will still use the memory (for example, user possibly addref the rpc and use its output for some other purpose).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

on leaf node or middle node, user lost control once the reply_send is called. But at root node, user's behavior is more flexible.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. So, anyway it will be better to change current proc and call free for all structures at RPC destroy time.

I'm going to work for this patch later. Now let's land this solution.

Copy link
Contributor

Choose a reason for hiding this comment

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

@liuxuezhao how is memory then free-ed on the root node? or does not not get allocated at all in this case on the root node as it is no longer sending the response to anyone and as such wont have those buffers?

Copy link
Contributor

Choose a reason for hiding this comment

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

root node free in "DAOS-6808 pool: Fix cleanuping resources #5008" in src/mgmt/srv_pool.c

Copy link
Contributor

Choose a reason for hiding this comment

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

@liuxuezhao if RPC is sent then proc functions are called. How it's possible to not use proc functions at all?

Copy link
Contributor Author

@liuxuezhao liuxuezhao Mar 16, 2021

Choose a reason for hiding this comment

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

on corpc root node, the bcast rpc is a "virtual" RPC, it just create a set of "real" RPC to its children. When forward to children it just copy the input struct to child real RPC, to get reply it just aggregate child's real rpc reply.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you may refer crt_corpc_req_hdlr()

Copy link
Contributor

Choose a reason for hiding this comment

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

@liuxuezhao Thanks! I will learn this logic in more details.

@liuxuezhao liuxuezhao requested review from dmiter and wangdi1 March 16, 2021 15:14
@dmiter dmiter requested review from a team and johannlombardi March 17, 2021 15:43
Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

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

LGTM. No errors found by checkpatch.

@dmiter
Copy link
Contributor

dmiter commented Mar 18, 2021

Can we land this?

@ashleypittman
Copy link
Contributor

Can we land this?

It's still in testing and like with your PR with this type of change it's important that we get a clean test run.

@dmiter
Copy link
Contributor

dmiter commented Mar 18, 2021

Can we land this?

It's still in testing and like with your PR with this type of change it's important that we get a clean test run.

Hmm. I'm not realized this is still under testing. It looks tests going verly long time.

@jolivier23
Copy link
Contributor

Can we land this?

It's still in testing and like with your PR with this type of change it's important that we get a clean test run.

Hmm. I'm not realized this is still under testing. It looks tests going verly long time.

It was merged with master 19 hours ago...patches seem to be taking more than 24 lately.

@liuxuezhao
Copy link
Contributor Author

@jolivier23 seem this PR has not been lended to master yet, could you please land it? thx

@liuxuezhao liuxuezhao requested a review from jolivier23 March 20, 2021 07:54
@dmiter dmiter requested a review from a team March 20, 2021 08:36
@jolivier23 jolivier23 merged commit 18efcd8 into master Mar 21, 2021
@jolivier23 jolivier23 deleted the lxz/fix_leak branch March 21, 2021 04:02
liuxuezhao added a commit that referenced this pull request Mar 21, 2021
1. provide co_post_reply to free memory
2. change corpc to not call co_post_reply on root node.

Signed-off-by: Xuezhao Liu <xuezhao.liu@intel.com>
mjmac pushed a commit that referenced this pull request Mar 26, 2021
1. provide co_post_reply to free memory
2. change corpc to not call co_post_reply on root node.

Master-PR: #5037

Signed-off-by: Xuezhao Liu <xuezhao.liu@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.

6 participants