# How to override destructor of an actor?

**URL:** <https://discuss.ray.io/t/how-to-override-destructor-of-an-actor/9470>\
**Category:** Ray Core\
**Created:** [February 23, 2023, 6:42am UTC](https://discuss.ray.io/t/how-to-override-destructor-of-an-actor/9470 "2023-02-23T06:42:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shyampatel](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@shyampatel](https://discuss.ray.io/u/shyampatel)\
**Post date:** [February 23, 2023, 6:42am UTC](https://discuss.ray.io/t/how-to-override-destructor-of-an-actor/9470/1 "2023-02-23T06:42:17Z")

</div>

**How severe does this issue affect your experience of using Ray?**

- High: It blocks me to complete my task.

In my project pipeline, my actor is being killed due to some error. Here I am creating specific queue for this actor. So I wanted to kill the queue also when actor is being killed/stopped.

How can I override destructor method of an actor? OR How can I set callback for actor deletion?

---

<div class="post-metadata">

**Author:** ![yic](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/yic/32/437_2.png) [@yic](https://discuss.ray.io/u/yic)\
**Post date:** [February 24, 2023, 1:28am UTC](https://discuss.ray.io/t/how-to-override-destructor-of-an-actor/9470/2 "2023-02-24T01:28:38Z")

</div>

You can ping the actor periodically by having some dummy function. Or you have an async actor and await for the dummy function which never reply. And once the actor is dead, it’ll throw exception.

We don’t support destructor because the actor might be killed by OS and fail to exit gracefully.
