[P/D] Support NIXL connector to disconnect during a clean shutdown - #24423
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces an explicit shutdown method for the NixlConnector to ensure proper resource cleanup, moving away from relying on __del__. The new method handles the shutdown of background threads and releases NIXL resources like dlist handles, remote agents, and registered memory. This is a significant improvement for ensuring a clean shutdown. My main feedback is regarding the shutdown of the _nixl_handshake_listener_t thread, which could be made more graceful.
0cb06b3 to
cfe5972
Compare
|
@njhill PTAL |
|
Thanks @chaunceyjiang, this seems reasonable (saw it plugs into the shutdown API that you just added in another PR). Have you observed what happens with this change when a prefill node is killed or scaled after handshaking with many decode nodes? Do you see disconnect logs in the decode peers? Any ill effects? |
|
Hi @wseaton Based on this PR, I tested two scenarios:
I also noticed that all nixl test examples explicitly call |
cfe5972 to
ee71e15
Compare
markmc
left a comment
There was a problem hiding this comment.
I'm not clear which cleanup call is doing more than just releasing memory that would be freed by when objects are finalized anyway ... is it remove_remote_agent() does a disconnect?
I guess it's fine to follow the recommended API usage ... but it looks like we're missing doing release_xfer_handle() on any in-progress _recving_transfers ?
Would you mind explaining how exactly the changes trigger this call? Thanks in advance |
@markmc Yes . If I’m not mistaken, it should be like this. |
NickLucche
left a comment
There was a problem hiding this comment.
Thanks for adding this @chaunceyjiang !
I think this is a good practice change, in particular as we expand Nixl to support different backends other than UCX, which may require specific resource cleanup.
While we're at it though, as we're already releasing data structures memory nixl-side, I think we should also release on-going transfers prior to that, as @markmc pointed out.
ee71e15 to
536ee9f
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
536ee9f to
34abddb
Compare
|
/cc @NickLucche PTAL. |
|
Thank you for explaining that I think we should ensure that |
f0779d2 to
c04ef5b
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com>
9b3f35c to
61d11fa
Compare
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
NickLucche
left a comment
There was a problem hiding this comment.
LGTM , thanks for adding tests as well @chaunceyjiang !
…llm-project#24423) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com>
…llm-project#24423) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: charlifu <charlifu@amd.com>
…24423) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: yewentao256 <zhyanwentao@126.com>
…llm-project#24423) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com>
…llm-project#24423) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com>
…llm-project#24423) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com>
…llm-project#24423) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com>
…llm-project#24423) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com>
…llm-project#24423) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: yewentao256 <zhyanwentao@126.com>
…llm-project#24423) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com>
…llm-project#24423) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: yewentao256 <zhyanwentao@126.com>
…llm-project#24423) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com>
…llm-project#24423) Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com> Co-authored-by: Mark McLoughlin <markmc@redhat.com>
Purpose
Part of #22295
Refer https://github.com/ai-dynamo/nixl/blob/main/examples/python/nixl_api_example.py#L205-L211
Test Plan