DAOS-18681 rebuild: fix potential memory leaks in error paths#17692
DAOS-18681 rebuild: fix potential memory leaks in error paths#17692wangshilong wants to merge 2 commits intomasterfrom
Conversation
Fix potential memory leaks in error cases in rebuild and IV path. Also Fixed a memmory allocation check typo to avoid potential crash Removed stale comments Signed-off-by: Wang Shilong <shilong.wang@hpe.com>
|
Ticket title is 'Fix potential memory Leaks ' |
src/cart/crt_iv.c
Outdated
| if (local_bulk != CRT_BULK_NULL) | ||
| crt_bulk_free(local_bulk); | ||
| if (rpc != NULL) | ||
| RPC_PUB_DECREF(rpc); |
There was a problem hiding this comment.
After calling crt_req_send(), the RPC reference will be automatically released even if crt_req_send() return failure? So we need to distinguish that?
There was a problem hiding this comment.
You are right, we need diff that case!
src/cart/crt_iv.c
Outdated
| if (local_bulk != CRT_BULK_NULL) | ||
| crt_bulk_free(local_bulk); | ||
| if (rpc != NULL) | ||
| RPC_PUB_DECREF(rpc); |
src/rebuild/srv.c
Outdated
| DL_ERROR(rc, DF_RB " scan broadcast send failed.", DP_RB_RGT(rgt)); | ||
| crt_req_decref(rpc); | ||
| D_GOTO(out, rc); | ||
| } |
There was a problem hiding this comment.
This is not for fixing leak, but for skipping "rgt_init_scan = 1' when dss_rpc_send() failed?
There was a problem hiding this comment.
you are right, I think I need revert this change. because even RPC failed, it might already send some RPCs to some targets, init_scan is used to check if we need kick off FAIL_RECLAIM task if rebuild fail for some reasons, if RPC has already reached some nodes(migration might have migrated some data, by design FAIL reclaim should be triggered in this case). So probably this is what original author wrote on purpose(even it is a bit strange and easy to trigger AI warnings)
Signed-off-by: Wang Shilong <shilong.wang@hpe.com>
|
good finding, is it cached by AI or by reading code? |
It is by AI. |
|
Test stage Functional Hardware Medium 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-17692/3/execution/node/429/log |
Fix potential memory leaks in error cases in rebuild and IV path. Also Fixed a memmory allocation check typo to avoid potential crash
Removed stale comments
Steps for the author:
After all prior steps are complete: