Non-detached actor names don't seem to be reclaimed when the actor exits.
Discovered while refactoring Serve to support clusters scoped to the driver program.
import time
import ray
ray.init()
@ray.remote
class A:
pass
a = A.options(name="hello").remote()
ray.kill(a, no_restart=True)
del a
# This loop never exits.
while True:
try:
ray.get_actor("hello")
print("Actor still alive")
except:
print("Actor was deleted")
break
time.sleep(1)
If we cannot run your script, we cannot fix your issue.
@ericl Making this P0 because it is a pretty fundamental issue for the named actor API and it's a blocker for the serve change we want to get in for 1.0. LMK if you disagree.
Little outside topic, but Why don't we make actors detached if name is provided but lifetime is not? It will secretly breaks lots of people's codebase otherwise.
re: @rkooo567 that would prevent users from creating non detached actors that are named, which is a key requirement from Ant and also used in RLlib (this was broken by the recent change to couple named with detached).
Ok I see, it's just an issue with removing the name label, only read the last comment.
This seems like it's probably the culprit:
https://github.com/ray-project/ray/blob/master/src/ray/gcs/gcs_server/gcs_actor_manager.h#L95
Most helpful comment
re: @rkooo567 that would prevent users from creating non detached actors that are named, which is a key requirement from Ant and also used in RLlib (this was broken by the recent change to couple named with detached).