Skip to content

[Core] Make sure Actor's __del__ method invoked on Actor's destruction #53169

@alexeykudinkin

Description

@alexeykudinkin

What happened + What you expected to happen

Currently, when actor's go out of scope we just exit the interpreter which skips __del__ method invocation leading to inability to do any of the clean ups in a straightforward fashion.

This is causing issues like #53124

Versions / Dependencies

2.46

Reproduction script

import ray

@ray.remote
class Actor:
    def __init__(self):
        print(">>> Actor.__init__")

    def echo(self):
        print(">>> Actor.echo")

    def __del__(self):
        print(">>> Actor.__del__")


actor = Actor.remote()

ray.wait(actor.echo.remote())

# Won't invoke __del__ on the actor class which creates a gap from pure Python-class perception
del actor

Issue Severity

None

Metadata

Metadata

Assignees

Labels

P1Issue that should be fixed within a few weeksbugSomething that is supposed to be working; but isn'tcommunity-backlogcoreIssues that should be addressed in Ray Corestabilityusability

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions