[Core| Client] Ray client fail to reconnect after explicit disconnect #46403
Labels
bug
Something that is supposed to be working; but isn't
core
Issues that should be addressed in Ray Core
core-client
ray client related issues
P2
Important issue, but not time-critical
What happened + What you expected to happen
Hi,
Our team is using Ray to develop some applications, and I am an intern helping to validate the performance of Ray. My task involves connecting to Ray using the Ray Client API and performing various tasks or deploying actors to measure Ray's performance.
To facilitate this, I implemented an API using FastAPI that connects to Ray through the Ray Client API with the Python SDK. When the application shuts down, I attempt to disconnect the Ray client. However, when I try to reconnect to Ray afterward, I encounter an issue.
I expected Ray to clean up the previous ClientContext and establish a new one. Instead, Ray tries to reuse the last ClientContext and repeatedly attempts to reconnect. Eventually, I receive the following error message:
Request can't be sent because the Ray client has already been disconnected due to an error. Last exception: Failed to reconnect within the reconnection grace period (30s)
I read the Ray documentation, which states that when using multiple Ray clients, you need to actively disconnect each connection. However, the actual operation failed. I would like to ask how to effectively release the connection through Ray Client to connect to Ray, so as not to affect subsequent connections.
Versions / Dependencies
OS: Mac
ray[client]==2.24.0
Python 3.10.14
fastapi==0.108.0
pydantic==1.10.13
uvicorn==0.25.0
Reproduction script
The general FastAPI code is as follows, and you can reproduce the problem by it:
Issue Severity
Medium: It is a significant difficulty but I can work around it.
The text was updated successfully, but these errors were encountered: