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

ActorSelection fails for ActorPath from remotely deployed actors #1544

Closed
Horusiath opened this issue Dec 14, 2015 · 18 comments
Closed

ActorSelection fails for ActorPath from remotely deployed actors #1544

Horusiath opened this issue Dec 14, 2015 · 18 comments

Comments

@Horusiath
Copy link
Contributor

Right now ActorSelection doesn't work when combined with path taken from remotely deployed actor:

// remoteRef is remotely deployed actor
system.ActorSelection(remoteRef.Path).Ask<ActorIdentity>(new Identify(null)).Result;

This operation will timeout - actor won't be find under provided path. Also any messages that will be send under actor selection specified that way will be send to dead letters on the remote node.

I don't know what is expected behavior on the JVM side for that.

@rogeralsing
Copy link
Contributor

@Horusiath
Copy link
Contributor Author

Scaka version for comparison:

override def getChild(names: Iterator[String]): InternalActorRef = {

    @tailrec
    def rec(s: String, n: Int): (InternalActorRef, Int) = {
      import akka.actor.ActorCell._
      val (childName, uid) = splitNameAndUid(s)
      getChild(childName) match {
        case null 
          val last = s.lastIndexOf('/')
          if (last == -1) (Nobody, n)
          else rec(s.substring(0, last), n + 1)
        case ref if uid != undefinedUid && uid != ref.path.uid  (Nobody, n)
        case ref  (ref, n)
      }
    }

    val full = Vector() ++ names
    rec(full.mkString("/"), 0) match {
      case (Nobody, _)  Nobody
      case (ref, 0)     ref
      case (ref, n)     ref.getChild(full.takeRight(n).iterator)
    }
  }

  final def splitNameAndUid(name: String): (String, Int) = {
    val i = name.indexOf('#')
    if (i < 0) (name, undefinedUid)
    else (name.substring(0, i), Integer.valueOf(name.substring(i + 1)))
  }

@alexpantyukhin
Copy link
Contributor

I will take it.

@Horusiath
Copy link
Contributor Author

@alexpantyukhin would you also submit a test case to ensure that this won't reappear in the future?

@alexpantyukhin
Copy link
Contributor

okay. I will

@rogeralsing
Copy link
Contributor

Also, before starting this.
Try the system.ActorSelection(remoteRef.Path).Ask<ActorIdentity>(new Identify(null)).Result; and put a breakpoint in RemoteSystemDaemon.GetChild and see if you even get there.

If not, then the issue resides elsewhere.

@maxim-s
Copy link
Contributor

maxim-s commented Dec 14, 2015

@maxim-s
Copy link
Contributor

maxim-s commented Dec 20, 2015

Looks like problem with transport protocol matching here
https://github.com/akkadotnet/akka.net/blob/dev/src/core/Akka.Remote/Remoting.cs#L295

but scala version has the same issue for remote ActorSelection e.g.
http://stackoverflow.com/questions/23827275/akka-remote-remotetransportexception-no-transport-is-loaded-for-protocol

local and client systems has different protocols e.g. akka and akka.tcp
and exception will be like

Akka.Remote.RemoteTransportExceptionNo transport is loaded for protocol: [akka], available protocols: [akka.test,akka.tcp]

Also for
https://github.com/rogeralsing/akka.net/blob/master/src/core/Akka.Remote/RemoteDaemon.cs#L165

I've prepared gist
https://gist.github.com/maxim-s/bd11eae2388b0ea2e7ed

@marcpiechura
Copy link
Contributor

@Horusiath @rogeralsing @maxim-s
Any ideas where to look next ?
The issue with the test transport protocol was fixed as well as the GetChild implementation but the bug still exists.

@maxim-s
Copy link
Contributor

maxim-s commented Jul 14, 2016

@Silv3rcircl3 do you have any log files? I can check but need more details

@marcpiechura
Copy link
Contributor

@maxim-s even better, I have a bunch of failing specs for you ;)
The new remoting spec is failing as well as 10 specs for the local actor selection! Even the Equals implementation seems to be broken.
https://github.com/Silv3rcircl3/akka.net/tree/ActorSelectionSpec

@Horusiath
Copy link
Contributor Author

@Silv3rcircl3 can we consider this solved?

@marcpiechura
Copy link
Contributor

@Horusiath nop, it's still not working for deployed actors. See my #2196 (comment)

@Danthar
Copy link
Member

Danthar commented Aug 29, 2017

Looks like this is fixed @Silv3rcircl3 can you confirm ?

@marcpiechura
Copy link
Contributor

marcpiechura commented Aug 29, 2017

@Danthar nope spec is still failing

@Aaronontheweb Aaronontheweb self-assigned this Apr 25, 2018
@Aaronontheweb Aaronontheweb added this to the 1.3.7 milestone Apr 25, 2018
@Aaronontheweb Aaronontheweb modified the milestones: 1.3.7, 1.3.8 May 15, 2018
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this issue May 23, 2018
@object
Copy link
Contributor

object commented May 31, 2018

Fantastic, thanks guys!

@Aaronontheweb
Copy link
Member

@object happy to do it - should be rolled into the latest nightlies tonight

@object
Copy link
Contributor

object commented May 31, 2018

Perfect timing for us!

cuteant pushed a commit to cuteant/akka.net that referenced this issue Jun 1, 2018
…kadotnet#1544

* fixed RemoteActorRef.GetChild

* fixed the first set of issues related to akkadotnet#1544

* close akkadotnet#3459 - just block until lock is available inside BlockingQueue

* close akkadotnet#3450 - don't let SplitBrainResolver log 'partition detected' messages when there are no unreachable nodes

* close akkadotnet#3420 - verified that wildcard ActorSelections actually do get delivered to deadletters when there's no matching recipient
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants