Fixed terminate_mp_processes to cover failure workers.#270
Open
hexinw-nvidia wants to merge 2 commits intoNVIDIA:mainfrom
Open
Fixed terminate_mp_processes to cover failure workers.#270hexinw-nvidia wants to merge 2 commits intoNVIDIA:mainfrom
hexinw-nvidia wants to merge 2 commits intoNVIDIA:mainfrom
Conversation
Contributor
Greptile SummaryThis PR broadens Key changes:
Confidence Score: 4/5
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["_shutdown(death_sig, timeout)"] --> B["_pcontext.close(death_sig, timeout)"]
B --> C{"Any orphan<br/>processes remain?"}
C -- "Worker died normally<br/>children reparented to PID 1" --> D["terminate_mp_processes<br/>allowed_ppids={1}<br/>allowed_pgids=_children_pgids"]
C -- "Worker stuck in D-state<br/>children still parented to worker" --> E["⚠ Orphans NOT caught<br/>(ppid ≠ 1 yet)"]
D --> F["psutil.process_iter<br/>attrs=['pid','ppid']"]
F --> G["For each process:<br/>check process.info['ppid'] in {1}"]
G -- "ppid match" --> H["check os.getpgid(pid)<br/>in _children_pgids"]
G -- "no match" --> F
H -- "pgid match" --> I["process.terminate()<br/>(SIGTERM)"]
H -- "no match" --> F
I --> J["Exception swallowed<br/>(best-effort)"]
E --> K["Known limitation:<br/>D-state processes<br/>cannot be signaled"]
Last reviewed commit: 5d7afa6 |
8609b06 to
692add3
Compare
Failure workers have orphan descendant processes left behind from SubprocessContext._close(). temrinate_mp_processes is the right place to catch all the orphan cleanup. Note if the orphan processes are temprorily or permanently stuck in the kernel I/O wait. The user-level signl based kill would not help.
e093ff8 to
93dd525
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Failure workers have orphan descendant processes left behind from SubprocessContext._close(). temrinate_mp_processes is the right place to catch all the orphan cleanup.
Note if the orphan processes are temprorily or permanently stuck in the kernel I/O wait. The user-level signl based kill would not help.