Repository navigation
Conversation
JobManager recorded the head's GCS address at construction and passed it to every detached JobSupervisor, which built its own GcsClient from it. With GCS fault tolerance the head pod can be replaced while a job keeps running on a worker: the worker's raylet and CoreWorker reconnect through the stable head service, but the supervisor's separately constructed client stays pinned to the old address. When the entrypoint then exits with code 0, put_status(SUCCEEDED) times out, the broad exception handler writes FAILED, and a job that succeeded is reported as JOB_SUPERVISOR_ACTOR_DIED. Use the GCS client already configured for the worker process hosting the actor. gcs_address and cluster_id_hex existed only to build that client, so they are removed from the supervisor signature and from the JobManager side. Signed-off-by: Roshan Sharma <[email protected]>
roshaninfordham
added a commit
to roshaninfordham/opensource-contributions
that referenced
this pull request
Aug 23, 2026
A job supervisor held a GCS client pinned to the head's address, so a successful job was reported FAILED after the head pod was replaced. The writeup covers the bug class -- a cached endpoint outliving what it points at -- and the two measurement mistakes the work nearly shipped: a linter run with default config rather than the project's, and a test run that was hung rather than slow. Also escape brackets in generated link text. Projects that prefix titles with tags like "[Core][Jobs]" produced nested brackets inside the markdown link, which parses wrong.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8cf0bc4f0e
ℹ️ 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".
Contributor
|
@rueian @MortalHappiness, could you guys take a look. |
MortalHappiness
approved these changes
Sep 1, 2026
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…oject#65686) Fixes ray-project#65608. ## Problem `JobManager` records the head's GCS address at construction and passes it to every detached `JobSupervisor`, which builds its own `GcsClient` from it: ```python # job_manager.py self._gcs_address = gcs_client.address ... supervisor = self._supervisor_actor_cls.options(...).remote( submission_id, entrypoint, metadata or {}, self._gcs_address, self._cluster_id_hex, self._logs_dir, ) # job_supervisor.py gcs_client = GcsClient(address=gcs_address, cluster_id=cluster_id_hex) ``` With GCS fault tolerance the head pod can be replaced while a job keeps running on a worker. The worker's raylet and CoreWorker reconnect through the stable head service, but the supervisor's separately constructed client stays pinned to the old address. When the entrypoint exits with code 0, `put_status(SUCCEEDED)` times out, the broad exception handler writes `FAILED`, and the job is reported as `JOB_SUPERVISOR_ACTOR_DIED` despite having succeeded. ## Fix Use the GCS client already configured for the worker process hosting the actor, which reconnects through the stable head service: ```python gcs_client = ray._private.worker.global_worker.gcs_client ``` `gcs_address` and `cluster_id_hex` existed only to build that client, so they are removed from the supervisor's signature and from the `JobManager` side. The same file already uses worker-local state a few lines below (`ray._private.worker.global_worker.node`), so this follows existing practice here. Net -4 lines. ## Not a duplicate `ray-project#65027` also concerns jobs during GCS failover, but patches `job_manager.py`'s monitor loop to retry transient gRPC errors. This patches `job_supervisor.py`'s client construction. They are complementary: retries in the monitor cannot help a supervisor whose own client is pinned to an address nothing is listening on. No other open PR references ray-project#65608. `gh pr list --search "job_supervisor"` and `--search "JobSupervisor gcs"` surfaced only ray-project#65006, ray-project#47166, ray-project#61099 and ray-project#65027, none of which touch this client construction. ## Testing Added `test_job_succeeds_when_manager_gcs_address_is_stale` in `python/ray/dashboard/modules/job/tests/test_job_manager.py`. The full reported path needs KubeRay with GCS FT and a head replacement; the essential condition is that the address the manager recorded is unusable while the worker's own client still works. `_StaleAddressGcsClient` wraps the live client and reports `127.0.0.1:1`, which is reserved and never bound. ``` python -m pytest python/ray/dashboard/modules/job/tests/test_job_manager.py -k stale -q ``` - on master: `1 failed` — the supervisor cannot persist the terminal status - with this change: `1 passed` in 12.70s Surrounding tests that exercise supervisor construction, job submission, supervisor logging and the existing failover path: ``` python -m pytest python/ray/dashboard/modules/job/tests/test_job_manager.py -q -p no:randomly \ -k "stale or network_fault_tolerance or supervisor_log_json or supervisor_logs_saved \ or submit_no_ray_address or get_all_job_info" 7 passed, 63 deselected in 82.54s ``` Lint, using the repo's own configuration: ``` pre-commit run --files python/ray/dashboard/modules/job/job_supervisor.py \ python/ray/dashboard/modules/job/job_manager.py \ python/ray/dashboard/modules/job/tests/test_job_manager.py ruff / pydoclint / black / Ray docstyle / semgrep / import order: all Passed ``` I did not get a clean full-module run locally: `test_job_manager.py` in its entirety stalls on this machine shortly after start (pytest idle at 0% CPU, no Ray processes alive) both with and without this change, so it looks unrelated to it. Happy to run anything specific a reviewer wants. Ray installed as `ray[default]` 2.58.0 with `python/ray/setup-dev.py` symlinks; tested on macOS (Apple silicon). ## Out of scope The `except Exception` handler in `JobSupervisor.run` reclassifies a failure to *persist* an already-known result as `JOB_ENTRYPOINT_COMMAND_START_ERROR`. That is a real second defect, but transient-error handling in this area is the subject of ray-project#65027, so it is left alone here to avoid a collision. ## AI usage AI assistance was used for the investigation, the code change, and the test. I reviewed every changed line, ran the commands above myself, and can explain and defend the change. Signed-off-by: Roshan Sharma <[email protected]>
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.
Fixes #65608.
Problem
JobManagerrecords the head's GCS address at construction and passes it toevery detached
JobSupervisor, which builds its ownGcsClientfrom it:With GCS fault tolerance the head pod can be replaced while a job keeps running
on a worker. The worker's raylet and CoreWorker reconnect through the stable head
service, but the supervisor's separately constructed client stays pinned to the
old address. When the entrypoint exits with code 0,
put_status(SUCCEEDED)timesout, the broad exception handler writes
FAILED, and the job is reported asJOB_SUPERVISOR_ACTOR_DIEDdespite having succeeded.Fix
Use the GCS client already configured for the worker process hosting the actor,
which reconnects through the stable head service:
gcs_addressandcluster_id_hexexisted only to build that client, so they areremoved from the supervisor's signature and from the
JobManagerside. The samefile already uses worker-local state a few lines below
(
ray._private.worker.global_worker.node), so this follows existing practicehere. Net -4 lines.
Not a duplicate
#65027also concerns jobs during GCS failover, but patchesjob_manager.py'smonitor loop to retry transient gRPC errors. This patches
job_supervisor.py'sclient construction. They are complementary: retries in the monitor cannot help a
supervisor whose own client is pinned to an address nothing is listening on.
No other open PR references #65608.
gh pr list --search "job_supervisor"and--search "JobSupervisor gcs"surfaced only #65006, #47166, #61099 and #65027,none of which touch this client construction.
Testing
Added
test_job_succeeds_when_manager_gcs_address_is_staleinpython/ray/dashboard/modules/job/tests/test_job_manager.py. The full reportedpath needs KubeRay with GCS FT and a head replacement; the essential condition is
that the address the manager recorded is unusable while the worker's own client
still works.
_StaleAddressGcsClientwraps the live client and reports127.0.0.1:1, which is reserved and never bound.1 failed— the supervisor cannot persist the terminal status1 passedin 12.70sSurrounding tests that exercise supervisor construction, job submission,
supervisor logging and the existing failover path:
Lint, using the repo's own configuration:
I did not get a clean full-module run locally:
test_job_manager.pyin itsentirety stalls on this machine shortly after start (pytest idle at 0% CPU, no
Ray processes alive) both with and without this change, so it looks unrelated to
it. Happy to run anything specific a reviewer wants.
Ray installed as
ray[default]2.58.0 withpython/ray/setup-dev.pysymlinks;tested on macOS (Apple silicon).
Out of scope
The
except Exceptionhandler inJobSupervisor.runreclassifies a failure topersist an already-known result as
JOB_ENTRYPOINT_COMMAND_START_ERROR. Thatis a real second defect, but transient-error handling in this area is the subject
of #65027, so it is left alone here to avoid a collision.
AI usage
AI assistance was used for the investigation, the code change, and the test. I
reviewed every changed line, ran the commands above myself, and can explain and
defend the change.