Skip to content
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 can receive a user message before Started message is successfully processed #31

Closed
james-cobb opened this issue Jan 16, 2018 · 2 comments

Comments

@james-cobb
Copy link
Contributor

Not sure what the intended behaviour is.

We have an actor that takes a long time to initialise, and this is carried out on receiving the Started message. If too long is taken a timeout exception can be thrown during initialisation. We would like to see restart attempts, but until the actor has returned from processing a Started message without exception, we don't want it to process any user messages.

However the actor does receive other user messages in between Started and Restarting messages. I wrote a quick test to demonstrate this:

    fun test() {
        val prop = fromFunc { msg ->
            println("Mssg Received " + msg.toString())
            when (msg) {
                is Started -> {
                    Thread.sleep(1000)
                    throw Exception()
                }
                else -> {

                }
            }
        }
        val pid = spawn(prop)
        for (i in 1..2) {
            send(pid, "Proto.Actor")
        }
        Thread.sleep(5000)
    }

Gives this:

Mssg Received actor.proto.Started@2f386338
Handling root failure for nonhost/$1
Restarting nonhost/$1 Reason java.lang.Exception
Mssg Received actor.proto.Restarting@379abc62
Mssg Received actor.proto.Started@2f386338
Handling root failure for nonhost/$1
Restarting nonhost/$1 Reason java.lang.Exception
Mssg Received Proto.Actor
Mssg Received actor.proto.Restarting@379abc62

@james-cobb
Copy link
Contributor Author

I have a proposed test+fix for this issue here
https://github.com/crowdconnected/protoactor-kotlin/tree/issue-31

@rogeralsing
Copy link
Contributor

Fixed by #33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants