Hi, what’s the approach for exiting an app which runs multiple threads in actor model, i.e. each thread lives forever? I have an app which I am working on that runs in a docker container and it hangs when I try to exit it, because of a fatal error which requires the app to abort.
I tried few approaches:
process::exit(1)on the main thread - hangs, process marked
panic!on main thread - hangs
- send all the actor threads STOP message, which cause them to break from the endless loop - hangs, from some reason all the actors seems to exit (i print the last line), but one of them, not always the same, keeps showing in
- same as (3) but actor thread either call
process::exit(1)when getting STOP message - hangs
The first and urgent question is how do I suppose to stop this thing??
The second question, which is more fundamental, how do I stop multithread app in rust? because it may be that the 3rd party libs I use or will use include threads which will not behave nicely and will hang my app on exit?
To be clear, the reason for the app to abort is abnormal, the app needs to exit no matter what, the state of the system is of less priority, and it shouldn’t happen much.
Appreciate the help!