Repository navigation
Closed
Description
What happened + What you expected to happen
When running Ray locally on Windows 10:
ray.init()
# Some distributed task
tune.run(...)it runs for 30 seconds and then terminates with the following error:
2022-04-15 18:40:10,052 ERROR ray_trial_executor.py:102 -- An exception occurred when trying to stop the Ray actor:Traceback (most recent call last):
File "<python>\lib\site-packages\ray\tune\ray_trial_executor.py", line 93, in post_stop_cleanup
ray.get(future, timeout=0)
File "<python>\lib\site-packages\ray\_private\client_mode_hook.py", line 105, in wrapper
return func(*args, **kwargs)
File "<python>\lib\site-packages\ray\worker.py", line 1811, in get
raise value
ray.exceptions.RayActorError: The actor died unexpectedly before finishing this task.
class_name: ImplicitFunc
actor_id: c422fd8fc896ec3e3073fb2201000000
pid: 17256
namespace: 88cbc294-b174-407a-98b8-4d963422ff38
ip: 127.0.0.1
The actor is dead because its owner has died. Owner Id: 01000000ffffffffffffffffffffffffffffffffffffffffffffffff Owner Ip address: 127.0.0.1 Owner worker exit type: NODE_DIED
Traceback (most recent call last):
File "<redacted program>", line 125, in <module>
asyncio.run(main())
File "c:\python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "c:\python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "<redacted program>", line 75, in main
analysis = tune.run(
File "<python>\lib\site-packages\ray\tune\tune.py", line 695, in run
raise TuneError("Trials did not complete", incomplete_trials)
ray.tune.error.TuneError: ('Trials did not complete', [_tune_train_9582e_00000])
Viewing the Ray logs the gRPC unavailable error comes up multiple times in different log files. The most detailed one can be found in dashboard.log:
2022-04-15 18:40:04,364 ERROR node_head.py:259 -- Error updating node stats of 5241012cc8ceeec135c64c837765766475f2416a95c21496eabd871c.
Traceback (most recent call last):
File "<python>\lib\site-packages\ray\dashboard\modules\node\node_head.py", line 250, in _update_node_stats
reply = await stub.GetNodeStats(
File "<python>\lib\site-packages\grpc\aio\_call.py", line 290, in __await__
raise _create_rpc_error(self._cython_call._initial_metadata,
grpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "failed to connect to all addresses"
debug_error_string = "{"created":"@1650040804.364000000","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3135,"referenced_errors":[{"created":"@1650040804.364000000","description":"failed to connect to all addresses","file":"src/core/lib/transport/error_utils.cc","file_line":163,"grpc_status":14}]}"
>
Even with the Windows firewall disabled it doesn't work. Though it does work when running it in WSL Ubuntu-18.04.
Versions / Dependencies
Relevant Python 3.9.7 libraries explicitly installed via Pipenv 2020.11.15:
ray[default, tune]==1.12.0
Windows 10 Pro version: 19044.1645
Reproduction script
In my case, I used a Pipenv virtual environment but I got the same result when testing with Venv:
pip install --user pipenv
# Need to manually install redis for ray to start
pipenv install ray[default] redis
pipenv run python ./main.pyContents of main.py:
import time
import ray
ray.init()
time.sleep(30)Issue Severity
Medium: It is a significant difficulty but I can work around it.
Reacted by Thomas Di Cizerone
Activity
czgdp1807 commentedon Apr 30, 2022
The script in the OP works fine with the
master(f725552) branch. Below are the logs,Details
I think this is connected with #23223. Not fully sure though. After merging with
masterworkers get enough time to register themselves in the worker pool so may be that's why the script in the OP worked with themasterbranch build.Jet132 commentedon May 1, 2022
Jet132 commentedon May 1, 2022
Nvm I was too quick to judge. Still the same error, even with the 2 newest passing commits (627b9f2 and f725552) on
master.czgdp1807 commentedon May 2, 2022
I executed the script multiple times on my system and it worked fine all the time. My Azure Windows has access to 8 CPUs and 16 GB RAM.
Jet132 commentedon May 2, 2022
I've run the script also multiple times on two separate machines (same windows versions, 32GB RAM, min 8 CPUs, 1 GPU) but to no avail.
With what systems does gRPC interact? Might be useful information as I could give a more detailed environment description and check for misconfigurations.
mattip commentedon May 3, 2022
The errors are being logged in the gRPC component, but they indicate that workers cannot be contacted. There are many causes for this. One is that it takes too much time to start the worker, so the monitoring process times out and reports an error back to the HEAD process. This is usually what I see when there is a
failed to connect to all addressesmessage. Especially suspicious is the report that the first line of output you reported isThe whole task should take less than the 30 seconds you report for just that line to appear.
I note you are using pipenv
How exactly are you setting this up, starting from opening a DOS box window? Maybe something in the interaction between pipenv and the environment variables it sets (
PATH,PYTHONPATH, etc) are causing worker startup to fail on windows?Jet132 commentedon May 3, 2022
Retested it with venv and an increased sleep of 30 seconds (updated the OP) with the same result. I'm using a normal pipenv installation (
pip install pipenv --user) and run the program inside thepipenv shell. One thing to note is that I have to manually install theredispackage to even be able to start the program.Here are the notable environment variables on the main and worker process:
The worker process has some additional variables:
Judging by the
python-core-worker-*.loglogs all the workers start up to 4 seconds after the driver. The actor itself gets created on the worker about 5 seconds after the first driver log entry. Here are the relevant log files:mattip commentedon May 5, 2022
Does anything change if you remove
Python310from your path?thomascizeron commentedon May 5, 2022
Same error here (Windows 10, ray==1.12.0, venv), managed to work around by using a global python install.
For info that was my PATH variable when I encountered this issue:
PATH=%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;%PyCharm%;C:\Users\<username>\AppData\Local\Programs\Microsoft VS Code\bin;mattip commentedon May 5, 2022
The fact that it works in a global install but not in "Windows 10, ray==1.12.0, venv" means that in order to fix this I need to know what you mean by that telegraphic phrase. How exactly did you set things up?
4 remaining items
czgdp1807 commentedon May 6, 2022
Ah! I see. I use conda environment on my windows to run your code. May be that's why I never received the error which you faced.
You can try using conda environment and let us know if you still face the same error. This might help in finding a point of difference and guide the investigation in a certain direction. Thanks.
P.S. I will try venv on my system tomorrow.
Jet132 commentedon May 7, 2022
Tried a few things with the python.org and Anaconda distributions and found some interesting results.
redis2022.5.23.9.123.9.123.9.124.11.03.9.12By user installed I mean
pip install --user <package>. While testing I noticed that there also isC:\Users\<user>\AppData\Local\Microsoft\WindowsApps\python.exein PATH, but as it is a later entry it doesn't get used.btw. @mattip your script does error if you extend
fs runtime to 30 seconds using for exampletime.sleep(30).mattip commentedon May 7, 2022
Thanks @Jet132 this is very helpful. Could you list the commands you used for the first two so that I can try to reproduce?
Jet132 commentedon May 7, 2022
The first one is documented in the initial issue post. The second one goes as follows:
mattip commentedon May 7, 2022
This is really strange. I cannot replicate your failures: neither the failure to see redis (I did not need to add it at all to the install command), nor the failure to run the test program, nor do I get an error when I add a
time.sleep(30)tof(). Do you have anyPYTHON*environment variables set (Doesset PYTHONprint anything)?Jet132 commentedon May 15, 2022
Sorry for the late reply. I was busy last week. No, there are no environment variable names containing
PYTHON.I've just tested a clean
3.9.12python.org default installation (except for enabling the "Add to PATH" option) on a second machine.It yielded the same results with
redishaving to be added manually and it erroring out after 30 seconds withGrpcUnavailable. Note that I used the following commandpipenv install ray[default] redisasray[tune]is not needed to reproduce the issue.sys.pathhad the following contents:Also I've check out the Microsoft Store installation at
C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\python[3].exeand it just opens the Python 3.10 store page. Meaning, it isn't actually installed and clearly doesn't get called.Edit: Updated the Pipenv command in the OP to also not install
ray[tune]and not use pre-release versions, asprotobuf==4.21.0rc1caused a new unrelated error.mattip commentedon May 17, 2022
The missing redis was reported in #23982, and fixed in #23991. You are correct that
pip installray[serve]` alone is broken for the 1.12.0 package.mattip commentedon May 18, 2022
xref #24905, which has a pure-python fix
Jet132 commentedon May 19, 2022
Will try out the new dev version once I have time and there is a passing build.
Out of curiosity: Were you able to reproduce the issue?
mattip commentedon May 19, 2022
Yes. It seems earlier I was focusing on the wrong areas: the redis thing was a false flag, and the agent issue only shows up after a 30 second timeout.
mattip commentedon May 19, 2022
Looking back, you had the
time.sleep()in your scripts that would have triggered the failure, I must have missed that.mattip commentedon May 28, 2022
@Jet132 if you could check with a nightly build that contains the fix from #24968, it would be nice to know for certain that this problem is fixed.
Jet132 commentedon May 28, 2022
Sorry forgot about it. Also never quite sure if the nightlies only get updated once a commit passed.
Anyway, the redis and timeout problems are both gone. 👍 Thank you very much for the proactive responses and the fix.