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
Hello, I believe I have found a race condition that occurs when the handling of the actor.Initialized or actor.Started message takes a significant amount of time (ex. loading state from db). In the example below, I demonstrate how if I sleep for 1 second during the actor.Started message, the message in the actor context is actually swapped for main.testMsg in the middle of handling the message. This is caused by the lack of synchronization between the startup sequence (actor.Initialized, actor.Started) with the handling of any other messages sent to the actor.
As you can see below, main.testMsg is incorrectly printed twice. The expected behavior would be to print actor.Initialized, actor.Started, and then main.testMsg.
$ go run .
2024/06/11 16:45:44 INFO actor.Initialized
2024/06/11 16:45:44 INFO main.testMsg
2024/06/11 16:45:45 INFO main.testMsg
I do this sort of asynchronous spawning and sending of messages to actors in my application quite often so this is causing real issues when attempting to load state. I propose some sort of synchronization between process.Start() and process.invokeMsg() to prevent an actor from receiving more than one message at a time. Thanks!
The text was updated successfully, but these errors were encountered:
Hello, I believe I have found a race condition that occurs when the handling of the actor.Initialized or actor.Started message takes a significant amount of time (ex. loading state from db). In the example below, I demonstrate how if I sleep for 1 second during the actor.Started message, the message in the actor context is actually swapped for main.testMsg in the middle of handling the message. This is caused by the lack of synchronization between the startup sequence (actor.Initialized, actor.Started) with the handling of any other messages sent to the actor.
As you can see below, main.testMsg is incorrectly printed twice. The expected behavior would be to print actor.Initialized, actor.Started, and then main.testMsg.
I do this sort of asynchronous spawning and sending of messages to actors in my application quite often so this is causing real issues when attempting to load state. I propose some sort of synchronization between process.Start() and process.invokeMsg() to prevent an actor from receiving more than one message at a time. Thanks!
The text was updated successfully, but these errors were encountered: