Repository navigation
Conversation
0887b9c to
2154977
Compare
There was a problem hiding this comment.
Code Review
This pull request updates the process termination logic to include zombie processes and modifies worker node startup by removing strict error checking. Review feedback highlights that the zombie process counting is over-inclusive and should be filtered to Ray-specific processes. Additionally, removing the error check in the worker startup command may silently ignore failures, suggesting a need for explicit return code verification or better documentation.
2154977 to
7207ffd
Compare
|
@machichima is interested in reviewing this PR |
… on worker block Signed-off-by: Samaresh Kumar Singh <[email protected]>
…de as warning Signed-off-by: Samaresh Kumar Singh <[email protected]>
Signed-off-by: Samaresh Kumar Singh <[email protected]>
28f1410 to
41202b8
Compare
Signed-off-by: Samaresh Kumar Singh <[email protected]>
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
Can someone take a look into this PR? |
|
sorry for the late review, will block time to review this |
There was a problem hiding this comment.
I just tested it on my computer using the “slurm-docker-cluster” project:
https://github.com/machichima/slurm-docker-cluster/tree/ray-on-slurm
I found that this does not resolve the original issue.
Please make sure to verify that the problem is actually fixed before pinging us next time. Thanks.
Here is the log from my test.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de64f46b24
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Code Review
This pull request improves process management and error handling in Ray scripts. It enhances the process termination logic in scripts.py to better handle zombie processes and improve progress tracking, and updates symmetric_run.py to distinguish between startup failures and cluster teardowns. The reviewer provided suggestions to optimize process iteration by leveraging the proc.info dictionary, improve the accuracy of the termination progress counter by including pre-stopped processes, and include SIGINT in the expected shutdown codes for better robustness.
|
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…IGINT Signed-off-by: Samaresh Kumar Singh <[email protected]>
Signed-off-by: Samaresh Kumar Singh <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 6187d7a. Configure here.
| pre_stopped.append(proc) | ||
| break | ||
| else: | ||
| process_infos.append((proc, name, cmdline)) |
There was a problem hiding this comment.
Cached info dict allows None values causing TypeError
Medium Severity
Switching from proc.name()/proc.cmdline() method calls to reading proc.info dict values removes the exception-based protection against inaccessible process attributes. With psutil 5.9.6 (Ray's pinned version), proc.info["cmdline"] returns None (the default ad_value) for processes where AccessDenied or NoSuchProcess occurred, rather than raising psutil.Error. The except psutil.Error: pass clause never fires since dict access doesn't raise. Processes with None cmdline or name are now added to process_infos, and the downstream subprocess.list2cmdline(proc_args) or keyword in corpus will crash with a TypeError when proc_args or corpus is None.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 6187d7a. Configure here.
|
Hi, can you fix the CI error? |
|
Hi, @ssam18 ray start --head
ray stopon macOS or Linux does not leave any zombie processes, but running the same commands in a Slurm Docker cluster does? |
|
Here is my research on the cause of the problem. take Linux as example (PID 1 is systemd)
compare to slurm docker cluster (PID 1 = slurmd)
Reference[1] https://github.com/torvalds/linux/blob/8ab992f815d6736b5c7a6f5fd7bfe7bc106bb3dc/kernel/exit.c#L737-L749 [5b] slurmd signal-handler functions — none reaps children: [5c] official slurmd manual SIGNALS section, no SIGCHLD: [6] SIGCHLD: a POSIX signal sent to a parent process whenever |
Future-Outlier
left a comment
There was a problem hiding this comment.
the solution seems correct, will review more tmr, plz fix the ci issue, tks!
|
/gemini review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6187d7a404
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pre_stopped.append(proc) | ||
| break | ||
| else: | ||
| process_infos.append((proc, name, cmdline)) |
There was a problem hiding this comment.
Filter out missing process attrs before queuing candidates
Using proc.info from psutil.process_iter([...]) can yield None for fields like cmdline or name when access is denied, but this code unconditionally appends those values into process_infos. Later matching calls subprocess.list2cmdline(proc_args) and keyword in corpus, which will raise TypeError when proc_args/corpus is None, causing ray stop to crash on systems with restricted /proc visibility (a regression from the previous proc.name()/proc.cmdline() calls that were skipped via psutil.Error).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Code Review
This pull request enhances process management and error reporting within Ray's scripts. It updates the process termination logic to accurately account for zombie processes and those that disappear during the shutdown sequence. Additionally, it improves worker startup diagnostics by distinguishing between expected shutdowns and early failures based on exit codes and execution duration. Feedback was provided to ensure robust handling of potentially null process attributes from psutil to prevent runtime errors.
| name = info["name"] | ||
| cmdline = info["cmdline"] |
There was a problem hiding this comment.
psutil can return None for process attributes like name and cmdline if they are not available (e.g., for some zombies or if the process disappears between the iteration and attribute access). If name is None and filter_by_cmd is True, the subsequent membership check (keyword in corpus) will raise a TypeError. Similarly, subprocess.list2cmdline will fail if cmdline is None. It is safer to default these to an empty string and an empty list, respectively.
| name = info["name"] | |
| cmdline = info["cmdline"] | |
| name = info["name"] or "" | |
| cmdline = info["cmdline"] or [] |
|
Hi, @ssam18 @SamareshSingh |
Yes, please go ahead and push a commit to this branch. I am a bit busy with something else. |
|
Update: I added an init process (tini) as PID 1 in my Docker container, and the zombie problem is gone — ray stop now sees status='terminated' instead of status='zombie'. What I think we should still do:
here's my slurm job log and screenshot proofs:
services:
mysql:
image: mariadb:12
hostname: mysql
container_name: mysql
environment:
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
MYSQL_DATABASE: ${MYSQL_DATABASE:-slurm_acct_db}
MYSQL_USER: ${MYSQL_USER:-slurm}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-password}
volumes:
- var_lib_mysql:/var/lib/mysql
networks:
- slurm-network
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
slurmdbd:
image: slurm-docker-cluster:${SLURM_VERSION:-25.11.2}
build:
context: .
args:
SLURM_VERSION: ${SLURM_VERSION:-25.11.2}
GPU_ENABLE: ${GPU_ENABLE:-false}
CUDA_VERSION: ${CUDA_VERSION:-12.6}
cache_from:
- slurm-docker-cluster:${SLURM_VERSION:-25.11.2}
init: true
command: ["slurmdbd"]
container_name: slurmdbd
hostname: slurmdbd
environment:
MYSQL_USER: ${MYSQL_USER:-slurm}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-password}
volumes:
- etc_munge:/etc/munge
- etc_slurm:/etc/slurm
- var_log_slurm:/var/log/slurm
expose:
- "6819"
depends_on:
mysql:
condition: service_healthy
networks:
- slurm-network
healthcheck:
test: ["CMD-SHELL", "pidof slurmdbd"]
interval: 10s
timeout: 5s
retries: 3
start_period: 20s
slurmctld:
image: slurm-docker-cluster:${SLURM_VERSION:-25.11.2}
init: true
command: ["slurmctld"]
container_name: slurmctld
hostname: slurmctld
privileged: true
working_dir: /data
environment:
ELASTICSEARCH_HOST: ${ELASTICSEARCH_HOST:-}
GPU_COUNT: ${GPU_COUNT:-1}
SSH_ENABLE: ${SSH_ENABLE:-false}
volumes:
- etc_munge:/etc/munge:z
- etc_slurm:/etc/slurm:z
- slurm_jobdir:/data:z
- var_log_slurm:/var/log/slurm:z
- ${SSH_AUTHORIZED_KEYS:-/dev/null}:/tmp/authorized_keys_host:ro,z
ports:
- "${SSH_PORT:-3022}:22"
expose:
- "6817"
depends_on:
slurmdbd:
condition: service_healthy
networks:
- slurm-network
healthcheck:
test: ["CMD-SHELL", "scontrol ping"]
interval: 10s
timeout: 5s
retries: 3
start_period: 20s
slurmrestd:
image: slurm-docker-cluster:${SLURM_VERSION:-25.11.2}
init: true
command: ["slurmrestd"]
container_name: slurmrestd
hostname: slurmrestd
privileged: true
volumes:
- etc_munge:/etc/munge
- etc_slurm:/etc/slurm
- var_log_slurm:/var/log/slurm
ports:
- "6820:6820"
expose:
- "6820"
depends_on:
slurmctld:
condition: service_healthy
networks:
- slurm-network
healthcheck:
test: ["CMD-SHELL", "test -S /var/run/slurmrestd/slurmrestd.socket"]
interval: 10s
timeout: 5s
retries: 3
start_period: 20s
c1:
image: slurm-docker-cluster:${SLURM_VERSION:-25.11.2}
init: true
command: ["slurmd"]
container_name: c1
hostname: c1
working_dir: /data
privileged: true
volumes:
- etc_munge:/etc/munge
- etc_slurm:/etc/slurm
- slurm_jobdir:/data
- var_log_slurm:/var/log/slurm
expose:
- "6818"
depends_on:
slurmctld:
condition: service_healthy
networks:
- slurm-network
healthcheck:
test: ["CMD-SHELL", "pidof slurmd"]
interval: 10s
timeout: 5s
retries: 3
start_period: 20s
c2:
image: slurm-docker-cluster:${SLURM_VERSION:-25.11.2}
init: true
command: ["slurmd"]
container_name: c2
hostname: c2
working_dir: /data
privileged: true
volumes:
- etc_munge:/etc/munge
- etc_slurm:/etc/slurm
- slurm_jobdir:/data
- var_log_slurm:/var/log/slurm
expose:
- "6818"
depends_on:
slurmctld:
condition: service_healthy
networks:
- slurm-network
healthcheck:
test: ["CMD-SHELL", "pidof slurmd"]
interval: 10s
timeout: 5s
retries: 3
start_period: 20s
c3:
image: slurm-docker-cluster:${SLURM_VERSION:-25.11.2}
init: true
command: ["slurmd"]
container_name: c3
hostname: c3
working_dir: /data
privileged: true
volumes:
- etc_munge:/etc/munge
- etc_slurm:/etc/slurm
- slurm_jobdir:/data
- var_log_slurm:/var/log/slurm
expose:
- "6818"
depends_on:
slurmctld:
condition: service_healthy
networks:
- slurm-network
healthcheck:
test: ["CMD-SHELL", "pidof slurmd"]
interval: 10s
timeout: 5s
retries: 3
start_period: 20s
c4:
image: slurm-docker-cluster:${SLURM_VERSION:-25.11.2}
init: true
command: ["slurmd"]
container_name: c4
hostname: c4
working_dir: /data
privileged: true
volumes:
- etc_munge:/etc/munge
- etc_slurm:/etc/slurm
- slurm_jobdir:/data
- var_log_slurm:/var/log/slurm
expose:
- "6818"
depends_on:
slurmctld:
condition: service_healthy
networks:
- slurm-network
healthcheck:
test: ["CMD-SHELL", "pidof slurmd"]
interval: 10s
timeout: 5s
retries: 3
start_period: 20s
# GPU compute node (NVIDIA)
# Requires: GPU_ENABLE=true in .env and nvidia-container-toolkit on host
g1:
image: slurm-docker-cluster:${SLURM_VERSION:-25.11.2}
init: true
command: ["slurmd"]
container_name: g1
hostname: g1
working_dir: /data
privileged: true
profiles: ["gpu"]
volumes:
- etc_munge:/etc/munge
- etc_slurm:/etc/slurm
- slurm_jobdir:/data
- var_log_slurm:/var/log/slurm
expose:
- "6818"
depends_on:
slurmctld:
condition: service_healthy
networks:
- slurm-network
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: ${GPU_COUNT:-1}
capabilities: [gpu, compute, utility]
healthcheck:
test: ["CMD-SHELL", "pidof slurmd"]
interval: 10s
timeout: 5s
retries: 3
start_period: 20s
# Optional Elasticsearch for job completion logging
# Start with: docker compose --profile monitoring up -d
# or with: make up-with-monitoring
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:9.3.0
profiles: ["monitoring"]
container_name: elasticsearch
hostname: elasticsearch
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
expose:
- "9200"
networks:
- slurm-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9200/_cluster/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
# Kibana for visualizing Elasticsearch job completions
kibana:
image: docker.elastic.co/kibana/kibana:9.3.0
profiles: ["monitoring"]
container_name: kibana
hostname: kibana
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
ports:
- "5601:5601"
depends_on:
elasticsearch:
condition: service_healthy
networks:
- slurm-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5601/api/status"]
interval: 10s
timeout: 5s
retries: 5
start_period: 60s
volumes:
etc_munge:
etc_slurm:
slurm_jobdir:
var_lib_mysql:
var_log_slurm:
elasticsearch_data:
networks:
slurm-network:
driver: bridge
|
|
close this PR due to #62390 (comment) if you think this PR should be accepted, plz let us know your thought. |
- Drop the imprecise "Docker's built-in --init" wording; --init is a flag that injects tini, not an init process itself. - Replace the unverifiable claim about kernel signal delivery to zombies with the documented fact that only waitpid(2) removes a zombie from the process table (cited from wait(2)). - Add inline citations to wait(2), signal(7), and the psutil source for wait_pid_posix's /proc/<pid> polling fallback (which is what makes ray stop classify zombies as still alive). - Link the SIGKILL escalation to its actual call site in python/ray/scripts/scripts.py. - Add tini and dumb-init repository references with their stated purpose (zombie reaping; dumb-init also handles Linux's PID 1 signal special case). - Group References by topic: Linux semantics, container init runtimes, ray stop tooling, and PR ray-project#62591 discussion. Signed-off-by: Future-Outlier <[email protected]>
) related issue: #62390 Due to the issue described in #62591 (comment), we have to add an init process as PID 1 in our Docker container. Doc link: https://anyscale-ray--63221.com.readthedocs.build/en/63221/cluster/vms/user-guides/community/slurm.html#troubleshooting --------- Signed-off-by: Future-Outlier <[email protected]>
…-project#63221) related issue: ray-project#62390 Due to the issue described in ray-project#62591 (comment), we have to add an init process as PID 1 in our Docker container. Doc link: https://anyscale-ray--63221.com.readthedocs.build/en/63221/cluster/vms/user-guides/community/slurm.html#troubleshooting --------- Signed-off-by: Future-Outlier <[email protected]>
…-project#63221) related issue: ray-project#62390 Due to the issue described in ray-project#62591 (comment), we have to add an init process as PID 1 in our Docker container. Doc link: https://anyscale-ray--63221.com.readthedocs.build/en/63221/cluster/vms/user-guides/community/slurm.html#troubleshooting --------- Signed-off-by: Future-Outlier <[email protected]> Signed-off-by: Alexandr Plashchinsky <[email protected]>



When running
ray symmetric-runon Slurm, Ray processes exit as zombies during teardown becauseray stopis not their parent process andpsutil.wait_procs()can't reap them viaos.waitpid()that causes a false "Stopped 0 out of N" warning even though the job completed cleanly. Separately, worker nodes were always hitting aCalledProcessErroron normal shutdown becauseray start --blockexits non-zero when GCS goes down, which is expected behavior and not an error. Both issues are fixed: zombies are now counted as pre-stopped before the signal loop, andcheck=Trueis removed from the worker's blockingray startcall. Fixes #62390.