Repository navigation
[core] Fix the Windows teardown error in the local:// working dir test - #66292
abrarsheikh merged 2 commits into
Conversation
Signed-off-by: YashwanthRanjanSingaravel <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request reorders the test fixtures in test_used_in_place_without_upload so that tmp_working_dir is requested before start_cluster. This ensures that pytest tears down the cluster before attempting to delete the temporary directory, preventing Windows file locking issues where a live worker process prevents directory removal. A detailed docstring explaining this behavior has also been added. There are no review comments to address.
| @pytest.mark.parametrize("option", ["working_dir", "py_modules"]) | ||
| def test_used_in_place_without_upload( | ||
| self, start_cluster, tmp_working_dir, option: str | ||
| self, tmp_working_dir, start_cluster, option: str |
There was a problem hiding this comment.
I'm wondering, even if we reverse the order, does cluster teardown necessarily mean the worker was removed? is it possible GCS and raylet tear down but worker only gets recycled later?
There was a problem hiding this comment.
Good catch, I think you're right. I've switched the test to a tmp_path directory that teardown never has to remove, so the fix no longer depends on when workers get reaped.
Signed-off-by: YashwanthRanjanSingaravel <[email protected]>
ray-project#66292) ## Description - `TestLocalWorkingDir::test_used_in_place_without_upload[working_dir]` passes, then errors at teardown. - On Windows the error is `RecursionError: maximum recursion depth exceeded`. - A `local://` working_dir is used in place, so `modify_context` makes it the worker's cwd. - Windows refuses to remove a directory a live process sits in, giving `WinError 32`. - `TemporaryDirectory`'s `onerror` handler then recurses until the stack runs out. - The test requested `start_cluster` before `tmp_working_dir`. - pytest tears fixtures down in reverse, so the directory went away while workers were alive. - Introduced by ray-project#65245. It only shows in the soft failing flaky Windows postmerge job. ## Changes - `test_runtime_env_working_dir.py`: request `tmp_working_dir` before `start_cluster`. - The cluster now tears down first. - `Cluster.shutdown` kills worker processes with `wait=True`, so the directory is free. - The docstring records why the fixture order matters. ## Tests - No new test. The existing `[working_dir]` parameter is the regression test, and it is the failing one. - `[py_modules]` already passed, because that path only extends `PYTHONPATH` and never sets cwd. - The production behaviour is unchanged; `test_directory_is_never_deleted` still covers it. --------- Signed-off-by: YashwanthRanjanSingaravel <[email protected]>
ray-project#66292) ## Description - `TestLocalWorkingDir::test_used_in_place_without_upload[working_dir]` passes, then errors at teardown. - On Windows the error is `RecursionError: maximum recursion depth exceeded`. - A `local://` working_dir is used in place, so `modify_context` makes it the worker's cwd. - Windows refuses to remove a directory a live process sits in, giving `WinError 32`. - `TemporaryDirectory`'s `onerror` handler then recurses until the stack runs out. - The test requested `start_cluster` before `tmp_working_dir`. - pytest tears fixtures down in reverse, so the directory went away while workers were alive. - Introduced by ray-project#65245. It only shows in the soft failing flaky Windows postmerge job. ## Changes - `test_runtime_env_working_dir.py`: request `tmp_working_dir` before `start_cluster`. - The cluster now tears down first. - `Cluster.shutdown` kills worker processes with `wait=True`, so the directory is free. - The docstring records why the fixture order matters. ## Tests - No new test. The existing `[working_dir]` parameter is the regression test, and it is the failing one. - `[py_modules]` already passed, because that path only extends `PYTHONPATH` and never sets cwd. - The production behaviour is unchanged; `test_directory_is_never_deleted` still covers it. --------- Signed-off-by: YashwanthRanjanSingaravel <[email protected]>
Description
TestLocalWorkingDir::test_used_in_place_without_upload[working_dir]passes, then errors at teardown.RecursionError: maximum recursion depth exceeded.local://working_dir is used in place, somodify_contextmakes it the worker's cwd.WinError 32.TemporaryDirectory'sonerrorhandler then recurses until the stack runs out.start_clusterbeforetmp_working_dir.Changes
test_runtime_env_working_dir.py: requesttmp_working_dirbeforestart_cluster.Cluster.shutdownkills worker processes withwait=True, so the directory is free.Tests
[working_dir]parameter is the regression test, and it is the failing one.[py_modules]already passed, because that path only extendsPYTHONPATHand never sets cwd.test_directory_is_never_deletedstill covers it.