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

Ask can't find temporary actor inside async context #4384

Closed
Aaronontheweb opened this issue Apr 22, 2020 · 0 comments · Fixed by #4789
Closed

Ask can't find temporary actor inside async context #4384

Aaronontheweb opened this issue Apr 22, 2020 · 0 comments · Fixed by #4789

Comments

@Aaronontheweb
Copy link
Member

Version: 1.4.4

The following code produces an AskTimeoutException:

public async Task ConsistentHashingPoolRoutersShouldWorkAsExpectedWithHashMapping()
        {
            var poolRouter =
                Sys.ActorOf(Props.Create(() => new ReporterActor(TestActor)).WithRouter(new ConsistentHashingPool(5,
                        msg =>
                        {
                            if (msg is IConsistentHashable c)
                                return c.ConsistentHashKey;
                            return msg;
                        })),
                    "router1");

            // use some auto-received messages to ensure that those still work
            var numRoutees = (await poolRouter.Ask<Routees>(new GetRoutees(), TimeSpan.FromSeconds(2))).Members.Count();

            // establish association between ActorSystems
            var sys2Probe = CreateTestProbe(Sys2);
            var secondActor = Sys.ActorOf(act => act.ReceiveAny((o, ctx) => ctx.Sender.Tell(o)), "foo");

            Sys2.ActorSelection(new RootActorPath(Sys1Address) / "user" / secondActor.Path.Name).Tell("foo", sys2Probe);
            sys2Probe.ExpectMsg("foo");

            // have ActorSystem2 message it via tell
            var sel = Sys2.ActorSelection(new RootActorPath(Sys1Address) / "user" / "router1");
            sel.Tell(new HashableString("foo"));
            ExpectMsg<HashableString>(str => str.Str.Equals("foo"));

            // have ActorSystem2 message it via Ask
            sel.Ask(new Identify("bar2"), TimeSpan.FromSeconds(3)).PipeTo(sys2Probe);
            var remoteRouter = sys2Probe.ExpectMsg<ActorIdentity>(x => x.MessageId.Equals("bar2"), TimeSpan.FromSeconds(5)).Subject;

            var s2Actor = Sys2.ActorOf(act =>
            {
                act.ReceiveAny((o, ctx) =>
                    sel.Ask<ActorIdentity>(new Identify(o), TimeSpan.FromSeconds(3)).PipeTo(sys2Probe));
            });
            s2Actor.Tell("hit");
            sys2Probe.ExpectMsg<ActorIdentity>(x => x.MessageId.Equals("hit"), TimeSpan.FromSeconds(5));
        }

Specifically, this line:

// have ActorSystem2 message it via Ask
sel.Ask(new Identify("bar2"), TimeSpan.FromSeconds(3)).PipeTo(sys2Probe);
var remoteRouter = sys2Probe.ExpectMsg<ActorIdentity>(x => x.MessageId.Equals("bar2"), TimeSpan.FromSeconds(5)).Subject;

From the logs:

DEBUG][4/22/2020 9:11:36 PM][Thread 0042][LocalActorRefProvider(akka://test2)] Resolve of path sequence [/temp/f] failed
[INFO][4/22/2020 9:11:36 PM][Thread 0009][akka://test2/temp/f] Message [ActorIdentity] from akka.tcp://test@localhost:55844/user/router1 to akka://test2/temp/f was not delivered. [1] dead letters encountered .This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.

The issue might be with running two ActorSystem instances in the same context, but this is 100% reproducible.

@Aaronontheweb Aaronontheweb added this to the 1.4.6 milestone May 5, 2020
@Aaronontheweb Aaronontheweb modified the milestones: 1.4.6, 1.4.7 May 12, 2020
@Aaronontheweb Aaronontheweb modified the milestones: 1.4.7, 1.4.8 May 26, 2020
@Aaronontheweb Aaronontheweb modified the milestones: 1.4.8, 1.4.9 Jun 17, 2020
@Aaronontheweb Aaronontheweb modified the milestones: 1.4.9, 1.4.10 Jul 21, 2020
@Aaronontheweb Aaronontheweb modified the milestones: 1.4.10, 1.4.11 Aug 20, 2020
@Aaronontheweb Aaronontheweb modified the milestones: 1.4.11, 1.4.12 Nov 5, 2020
@Aaronontheweb Aaronontheweb modified the milestones: 1.4.12, 1.4.13 Nov 16, 2020
@Aaronontheweb Aaronontheweb modified the milestones: 1.4.13, 1.4.14 Dec 16, 2020
@Aaronontheweb Aaronontheweb modified the milestones: 1.4.14, 1.4.15 Dec 30, 2020
@Aaronontheweb Aaronontheweb modified the milestones: 1.4.15, 1.4.16 Jan 20, 2021
@Aaronontheweb Aaronontheweb added this to Needs triage in Akka.NET Sprint 2/8 - 2/22 via automation Feb 11, 2021
@IgorFedchenko IgorFedchenko moved this from Needs triage to Low priority in Akka.NET Sprint 2/8 - 2/22 Feb 17, 2021
@IgorFedchenko IgorFedchenko moved this from Low priority to In Review in Akka.NET Sprint 2/8 - 2/22 Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
2 participants