Closed erplsf closed 3 years ago
Thanks for finding this. It was a race condition in the parallel creation of global actors. The latest master commit should resolve this; if you can confirm this works in your larger scenario I will generate a new release with this updated functionality.
Tested with 9aa5e33
- couldn't reproduce anymore. Tested with our application - the same results, doesn't seem to occur anymore.
Thank you.
Released in version 3.10.5
Greetings,
Here's our usecase - we have a troupe which receives the messages with items of different types, and dispatches them to the corresponding processors (which can be global actors, if they depend on some internal state for processing). The dispatcher creates the actors based on what messages come to it, and we started noticing that sometimes global actors are created more than once, and then deleted by ActorSystem without us explicitly requesting it. It doesn't cause issues in our current implementation but raises questions - why does it happen, can it happen later, and what if some of this "ghost" actors receive our messages?
I suspect there's a race condition involved somewhere. What points us in that direction - if we create global actors once in sequential manner in main thread, they're later resolved correctly and created only once.
Here's the smallest example I crafted to reproduce this behaviour:
If you run this example a few times you'll see the output messages like this:
Even though we didn't explicitly request GlobalActor to stop! (I'm assuming that global actors are not receiving
ActorExitRequest
when Actor that created them dies - according to paragraph 3.1 on this page: https://thespianpy.com/doc/using#outline-container-orgd1bc6f9)Please advise us - if this is an expected behaviour, or we're abusing Thespian in some way.