Repository navigation
UCP/GTEST: fix and test rndv requests leak from the ptr_map. #5769
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
Changes from 2 commits
7d1cbe6
a8a3db6
91c8e11
284df93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,6 +131,7 @@ ucs_ptr_map_extract(ucs_ptr_map_t *map, ucs_ptr_map_key_t key) | |
| void *value; | ||
|
|
||
| if (ucs_likely(!(key & UCS_PTR_MAP_KEY_INDIRECT_FLAG))) { | ||
| ucs_assert(key != 0); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? NULL is also pointer, kind of...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why would you want to put a null pointer into the ptr_map..?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO NULL pointer is incorrect usage (we expect an id to resolve to a valid object), and ptr_map can help by catching this early
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't :) but IMHO it should not be restricted in UCS |
||
| return (void*)key; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -978,34 +978,38 @@ class test_ucp_sockaddr_protocols : public test_ucp_sockaddr { | |
|
|
||
| void test_tag_send_recv(size_t size, bool is_exp, bool is_sync = false) | ||
| { | ||
| std::string send_buf(size, 'x'); | ||
| std::string recv_buf(size, 'y'); | ||
| /* send multiple messages to test the protocol both before and after | ||
| * connection establishment */ | ||
| for (int i = 0; i < 100; i++) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a dependency on this change. @alinask what about creating a separate PR with sockaddr-only change to test before/after connection establishment? If you wish, I could help with that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dmitrygx which PR is dependent on this?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| std::string send_buf(size, 'x'); | ||
| std::string recv_buf(size, 'y'); | ||
|
|
||
| void *rreq = NULL, *sreq = NULL; | ||
| void *rreq = NULL, *sreq = NULL; | ||
|
|
||
| if (is_exp) { | ||
| rreq = ucp_tag_recv_nb(receiver().worker(), &recv_buf[0], size, | ||
| ucp_dt_make_contig(1), 0, 0, rtag_complete_cb); | ||
| } | ||
| if (is_exp) { | ||
| rreq = ucp_tag_recv_nb(receiver().worker(), &recv_buf[0], size, | ||
| ucp_dt_make_contig(1), 0, 0, rtag_complete_cb); | ||
| } | ||
|
|
||
| if (is_sync) { | ||
| sreq = ucp_tag_send_sync_nb(sender().ep(), &send_buf[0], size, | ||
| ucp_dt_make_contig(1), 0, scomplete_cb); | ||
| } else { | ||
| sreq = ucp_tag_send_nb(sender().ep(), &send_buf[0], size, | ||
| ucp_dt_make_contig(1), 0, scomplete_cb); | ||
| } | ||
| if (is_sync) { | ||
| sreq = ucp_tag_send_sync_nb(sender().ep(), &send_buf[0], size, | ||
| ucp_dt_make_contig(1), 0, scomplete_cb); | ||
| } else { | ||
| sreq = ucp_tag_send_nb(sender().ep(), &send_buf[0], size, | ||
| ucp_dt_make_contig(1), 0, scomplete_cb); | ||
| } | ||
|
|
||
| if (!is_exp) { | ||
| short_progress_loop(); | ||
| rreq = ucp_tag_recv_nb(receiver().worker(), &recv_buf[0], size, | ||
| ucp_dt_make_contig(1), 0, 0, rtag_complete_cb); | ||
| } | ||
| if (!is_exp) { | ||
| short_progress_loop(); | ||
| rreq = ucp_tag_recv_nb(receiver().worker(), &recv_buf[0], size, | ||
| ucp_dt_make_contig(1), 0, 0, rtag_complete_cb); | ||
| } | ||
|
|
||
| request_wait(sreq); | ||
| request_wait(rreq); | ||
| request_wait(sreq); | ||
| request_wait(rreq); | ||
|
|
||
| compare_buffers(send_buf, recv_buf); | ||
| compare_buffers(send_buf, recv_buf); | ||
| } | ||
| } | ||
|
|
||
| void wait_for_server_ep() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to assert in UCS,
sreq_id == NULLhere? if yes, is it expected by protocol?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when tag_offload is used, the msg_proto struct should not be access here, but rather the tag_offload struct (which doesn't have the sreq_id field).
but since tag_offload doesn't support error handling, the del_req_id function "won't do anything" anyway so it should be ok not to call it in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so it should be in
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checking ucp_ep_use_indirect_id(ep) makes the del_req_id call dependant on err_handling support rather than the used protocol (when checking the sreq->flags)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but union in
sreq->send(to accesssreq->send.msg_proto.sreq_id) is protocol specific but not err_handleng modeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes but, adding and removing from the ptr_map is err_handling dependant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ucp_worker_del_request_idalready should handle err handling inside by indirect flag presence, ifsreq_idis not valid by some other logic - it should be handled accordinglyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm fine with both ways.
@yosefe wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for now let's check for NULL in ptr_map, it's usefult for TCP ep's as well and document it
if we'll have use case where map should hold NULL can move the check to upper layers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean? we can't access msg_proto here for tag_offload