You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Actix 0.7.9. I'm reading this documentation, which says the following:
The Actor's execution state changes to the stopping state in the following situations:
Context::stop is called by the actor itself
all addresses to the actor get dropped. i.e. no other actor references it.
no event objects are registered in the context.
I was slightly confused then when an actor was not being stopped even though the situation described by the second bullet occurred ("all addresses to the actor get dropped"). Through testing, I realized that the reason was because the actor had a run_interval function. If I removed that interval function, it would stop as expected.
I'm not sure if using run_interval in this way is what is meant in the third bullet ("no event objects are registered in the context." However, even in that case the wording is such that I would assume that the actor stops if any of the three situations occur, regardless of the others.
I'm not sure if this is a situation where the behavior is as-expected, and the documentation needs to be touched up, or if there is a bug.
Example Code
Based on the documentation, I would expect that this code stop the child actor almost immediately after stopping the parent actor. Instead, the child actor lives forever.
The text was updated successfully, but these errors were encountered:
markhildreth
changed the title
Actors do not stop after addresses dropped due to interval
Actors do not stop after addresses dropped due to run_interval
Sep 18, 2019
just ran into the same question. is there any best practice here? how do I stop an interval?
UPDATE: oops my bad 😄 of course the interval stops when its context is stopped, I had a bug and didn't stop my actor correctly under all circumstances.
I have found any of the interval/run_later commands have this effect (eg, run_later, notify_later) seem to cause it.
Not sure how to run things like a heartbeat for a websocket actor an if an interval or calling these other methods once prevents it from ever being stopped. (This problem is made worse if it is a supervised actor, and all addresses being dropped is the only real way to stop the actor, as a ctx.stop() will just cause it to be restarted).
I'm using Actix 0.7.9. I'm reading this documentation, which says the following:
I was slightly confused then when an actor was not being stopped even though the situation described by the second bullet occurred ("all addresses to the actor get dropped"). Through testing, I realized that the reason was because the actor had a
run_interval
function. If I removed that interval function, it would stop as expected.I'm not sure if using
run_interval
in this way is what is meant in the third bullet ("no event objects are registered in the context." However, even in that case the wording is such that I would assume that the actor stops if any of the three situations occur, regardless of the others.I'm not sure if this is a situation where the behavior is as-expected, and the documentation needs to be touched up, or if there is a bug.
Example Code
Based on the documentation, I would expect that this code stop the child actor almost immediately after stopping the parent actor. Instead, the child actor lives forever.
The text was updated successfully, but these errors were encountered: