Repository navigation
[core] Detach the driver when a rejected local:// URI leaves it connected - #66302
Merged
rueian merged 3 commits intoSep 28, 2026
Conversation
Signed-off-by: YashwanthRanjanSingaravel <[email protected]>
YashwanthRanjanSingaravel
marked this pull request as ready for review
September 18, 2026 22:15
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds a cleanup step using disable_client_hook and ray.shutdown() in test_relative_path_rejected_on_the_client to detach the driver from the head node after a failed ray.init call. The review feedback correctly points out that if the test fails before reaching this cleanup, the shutdown will be skipped, which can mask the original failure during cluster teardown. It is recommended to wrap the cleanup in a try...finally block or register a cleanup finalizer to ensure it always runs.
Signed-off-by: YashwanthRanjanSingaravel <[email protected]>
rueian
approved these changes
Sep 28, 2026
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…cted (ray-project#66302) ## Description - `TestLocalWorkingDir::test_relative_path_rejected_on_the_client` passes, then errors at teardown. - Only in `//python/ray/tests:test_runtime_env_working_dir_client_mode`, on every Windows postmerge run. - The teardown error is: - `ValueError: Removing a node that is connected to this Ray client is not allowed` - raised by `Cluster.remove_node` at `cluster_utils.py:305`. - `connect` sets `worker.node` before it validates the runtime_env. - `worker.py:2649` reads `worker.node.get_runtime_env_dir_path()`, then calls `upload_working_dir_if_needed`. - `parse_uri` rejects the relative `local://` path there, so `ray.init` raises after connecting. - The driver is left attached to the head node. - Under `RAY_CLIENT_MODE=1` the fixture's own `ray.shutdown` is redirected to the Ray Client. - It never reaches `disconnect`, which is what clears `worker.node` at `worker.py:2827`. - That is why the plain target passes and only the client mode target fails. - Introduced by ray-project#65245. ## Changes - `test_runtime_env_working_dir.py`: detach the driver after the expected `ValueError`. - The `ray.shutdown` runs inside `disable_client_hook` so it reaches the real one in both modes. - `disable_client_hook` restores the previous hook state on exit; `test_client.py` already uses it. ## Tests - No new test. The existing test is the regression test, and it is the one erroring today. - Verified the bypass with `RAY_CLIENT_MODE=1`: `client_mode_should_convert()` is `True` normally, `False` inside `disable_client_hook()`, and `True` again afterwards. - The client side rejection itself stays covered by `unit/test_runtime_env_working_dir.py`. --------- Signed-off-by: YashwanthRanjanSingaravel <[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.
Description
TestLocalWorkingDir::test_relative_path_rejected_on_the_clientpasses, then errors at teardown.//python/ray/tests:test_runtime_env_working_dir_client_mode, on every Windows postmerge run.ValueError: Removing a node that is connected to this Ray client is not allowedCluster.remove_nodeatcluster_utils.py:305.connectsetsworker.nodebefore it validates the runtime_env.worker.py:2649readsworker.node.get_runtime_env_dir_path(), then callsupload_working_dir_if_needed.parse_urirejects the relativelocal://path there, soray.initraises after connecting.RAY_CLIENT_MODE=1the fixture's ownray.shutdownis redirected to the Ray Client.disconnect, which is what clearsworker.nodeatworker.py:2827.Changes
test_runtime_env_working_dir.py: detach the driver after the expectedValueError.ray.shutdownruns insidedisable_client_hookso it reaches the real one in both modes.disable_client_hookrestores the previous hook state on exit;test_client.pyalready uses it.Tests
RAY_CLIENT_MODE=1:client_mode_should_convert()isTruenormally,Falseinsidedisable_client_hook(), andTrueagain afterwards.unit/test_runtime_env_working_dir.py.