Hello,
Akka docs say:

> Warning
>
> Keep in mind that an actor stopping and its name being deregistered are 
> separate events which happen asynchronously from each other. Therefore it 
> may be that you will find the name still in use after gracefulStop() 
> returned. 
> In order to guarantee proper deregistration, only reuse names from within a 
> supervisor you control and only in response to a Terminated message, i.e. 
> not for top-level actors.
>

But when testing one of the actors I get InvalidActorNameException even 
after expectTerminated was successful. This is the test:


"stop self when finished" in {
 val fetcher = system.actorOf(EventFetcherActor.props(eventId), "name1")

 watch(fetcher)
 // interact with the actor, it will call context.stop(self) after 
interaction
 expectTerminated(fetcher)

 system.actorOf(EventFetcherActor.props(eventId), "name1") //Exception 
thrown
}

90% of times I run it, the test passes. But what is the reason of failures? 
Can it be related to the fact that it's unit test? 

This is exception message I get:
actor name [name1] is not unique!
akka.actor.InvalidActorNameException: actor name [name1] is not unique!
at 
akka.actor.dungeon.ChildrenContainer$NormalChildrenContainer.reserve(ChildrenContainer.scala:129)
at akka.actor.dungeon.Children$class.reserveChild(Children.scala:130)
at akka.actor.ActorCell.reserveChild(ActorCell.scala:374)
at akka.actor.dungeon.Children$class.makeChild(Children.scala:268)
at akka.actor.dungeon.Children$class.attachChild(Children.scala:46)

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to