val sel = context.actorSelection(escape(myActorName))
val future = sel.ask(Identify(None))(myTimeout).mapTo[ActorIdentity].map(_.ref)
val opt: Option[ActorRef] = Await.result(future, myTimeout)
The above code always throw TimeoutException. Why?
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> 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+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.
Endre,Your code works in console. I guess I'm seeing the TimeoutException because I'm doing Await.result inside an actor.
More info:Please see the log below ("xitrum" is my actor system). Why there are "[akka://xitrum/deadLetters] Message [akka.actor.ActorIdentity]" and "[akka://xitrum/deadLetters]"?
The error log belongs to the case when there's Await.result inside an actor. Await.result should not be there in the first place as I understand. Do you still want the sample code with Await.result inside an actor?
is there some docs explaining (in more details):
a) routing/delivery logic when using ActorSelection - since the delivery to ActorSelection is more complicated, is it slower (if compare to clean ActorRef)?
b) implementation of Identify - does it mean that Identify message goes through mailboxes of multiple actors (maybe internally without calling "receive" method)?
--
Victor
On 19.07.2013 14:52, Akka Team wrote:
Hi Ngoc!
I finally had some time, and I figured it out what went wrong. You
actually did manage to deadlock your actor :)
The actor selection you tried to look up looks like the following:
ActorSelection[Actor[akka://glokka/user/test#244828061]/nonexistent]
A selection consists of two parts, an anchor, which is a known actorref,
and a path part that will be tried to be looked up. The Identify message
travels down from the anchor through the matching children recursively*
until it finds the matching child/children. In this case however the
anchor is blocking on the result of the future, so it cannot process the
Identify, and since it does not process the Identify, it waits until
Timeout. At that point of course the Identify will be processed, but the
result will be delivered to dead letters already.
[* sort-of, I simplified the story a bit]
You can try this by replacing
context.actorSelection(escape(name))
to
context.system.actorSelection(escape(name))
which changes the anchor to be the system ref itself, avoiding the deadlock.
Anyway, don't block your actors ;)
-Endre
--
--- You received this message because you are subscribed to the Google Groups "Akka User List" group.Read the docs: http://akka.io/docs/
Check the FAQ: http://akka.io/faq/
Search the archives: https://groups.google.com/group/akka-user
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.
From reading docs & letitcrash blogs I was sure that ActorSelection is almost the same (at least for very similar purposes) as ActorRef but it does not point to specific actor identity.
Seems we were able to find RemoteActorRef (with old actorFor) easily, but sending to ActorSelection requires more complicated lookup of a destination, is it correct?
ActorSelection will (by AkkaTeam intention) take a very important place in akka world - it will be used in all apps using Remoting without cluster-aware routers and other high-level cluster logic,
so its behavior should be well-understood by users!
--
Victor
--
--- You received this message because you are subscribed to the Google Groups "Akka User List" group.Read the docs: http://akka.io/docs/
Check the FAQ: http://akka.io/faq/
Search the archives: https://groups.google.com/group/akka-user
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.