-
Notifications
You must be signed in to change notification settings - Fork 643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Actor doesn't fully stops when stopping
returns Running::continue
at least once
#332
Comments
I find this example can be considered anti pattern. Note: I'm not saying the problem is non exist but one that cause this in actor handler method would be more proper than the current one. |
I experience an opposite behaviour. Sometimes my websocket handling actors are dropped off after returning |
I have been experimenting the current actix's Async Context implementation,
Context
, and I've come across a characteristic that I don't know if its a bug or the expected behavior. Check the following code:This exemple naturally stops, since the Actor will have no live Address holders and no futures to process, when stopping the
stopping
method is called setting the shared data which unlocks the main function.Now if we change the
stopping
method to the following:I would expect that the
stopping
method wold be called multiple times, and that eventually the Actor would fully stop. What happens in fact is that the Actor's future will be pending when it first returnsRunning::Continue
, but then it won't ever be waken. Running this ongdb
makes it easy to see that the Future stops being polled.I have a simple solution for it which wold be adding a
cx.waker().wake_by_ref();
to the Future when it becomesPending
due toRunning::Continue
returned by thestopping
method. That way the Future wold immediately be available to be polled by the runtime again and this example would finish.What do you guys think? Should the Actor future be waking itself in case of
stopping
returning aRunning::Continue
, or should it only be waken by external sources, e.g, new message being received.The text was updated successfully, but these errors were encountered: