These are chat archives for akkadotnet/akka.net

11th
Aug 2016
Chris Ochs
@gamemachine
Aug 11 2016 00:02
our use case I'm just thinking the simpler solution might be better. db state backed by our own logic to track if a node is available, not run cluster at all. At most I'm looking at half a dozen app servers, with a minimum for redundancy. If a node fails I kind of want to just take it down manually
In practice I found that worked well on other games where we were running several hundred boxes (not akka).
But then I have to give up distributed pub sub for our chat, so that would suck
Corneliu
@corneliutusnea
Aug 11 2016 04:41
guys, is there a reliable way to find the Parent of an Actor? it seems to be different if an actor is created directly or through a router.
Aaron Stannard
@Aaronontheweb
Aug 11 2016 04:42
the router is the parent
in a pool router scenario
Corneliu
@corneliutusnea
Aug 11 2016 04:42
bugger .. can I reach the real Parent?
I thought routers are mostly transparent
as I can add them from config I didn't expect they break the hierarchy
Aaron Stannard
@Aaronontheweb
Aug 11 2016 04:42
Context.ActorSelection("../../") will reach the grand parent
they don't break the hierarchy - they're part of it
Corneliu
@corneliutusnea
Aug 11 2016 04:43
yeah, but that's a lot slower
Aaron Stannard
@Aaronontheweb
Aug 11 2016 04:43
Context.ActorSelection("../../").ResolveOne and cache the result
Corneliu
@corneliutusnea
Aug 11 2016 04:43
plus I don't know if my actor is used with or without a router so I know to select "../" or "../" to reach my real parent
Aaron Stannard
@Aaronontheweb
Aug 11 2016 04:43
that will return the actorref
best solution in your case then is probably to use the direct target pattern
Corneliu
@corneliutusnea
Aug 11 2016 04:44
this feels very odd for an actor to not have a reliable way to reach it's real parent
Aaron Stannard
@Aaronontheweb
Aug 11 2016 04:44
pass the reference from parent to child directly into the child actor's constructor
the router is the real parent
when you specify that you want a pool of actors
they have to live somewhere
Corneliu
@corneliutusnea
Aug 11 2016 04:44
but I don't have one directly, unless I introduce some new message .. argh
ok, back to the design board :/
Aaron Stannard
@Aaronontheweb
Aug 11 2016 04:45
MyFooActor(IActorRef target)
just add that
and pass the reference of the original actor into the props of the routee
Corneliu
@corneliutusnea
Aug 11 2016 04:45
is that the constructor?
Aaron Stannard
@Aaronontheweb
Aug 11 2016 04:45
yeah
I do that all the time for testing purposes
Corneliu
@corneliutusnea
Aug 11 2016 04:46
I use DI
Aaron Stannard
@Aaronontheweb
Aug 11 2016 04:46
it also decouples the actor class from its position in the hierarchy
Corneliu
@corneliutusnea
Aug 11 2016 04:46
Context.ActorOf(Context.DI().Props<SendSaveResultsActor>()
I can't do that with DI
Aaron Stannard
@Aaronontheweb
Aug 11 2016 04:46
yeah, not today
we discussed future changes we're considering making to it to allow you to mix DI with arguments
but that will not be delivered on-time for your project
in the short run it'd probably be best to use a setter message instead of a constructor argument
the parent actor will be able to tell if its child is a router or a concrete actor
you can tell by looking at the IActorRef
it'll be a RoutedActorRef if it's a router
Corneliu
@corneliutusnea
Aug 11 2016 04:49
would that work with a resize?
Aaron Stannard
@Aaronontheweb
Aug 11 2016 04:49
ouch, not in that case
Corneliu
@corneliutusnea
Aug 11 2016 04:49
so now when I create the actor I fire a new Broadcase(my message)
that works in the initial but now after a resize :(
Aaron Stannard
@Aaronontheweb
Aug 11 2016 04:49
no it wouldn't
the resizer is not a feature I recommend using anyway
Corneliu
@corneliutusnea
Aug 11 2016 04:50
:worried:
Aaron Stannard
@Aaronontheweb
Aug 11 2016 04:50
I've had tremendous trouble tuning it myself
it's extremely sensitive
Corneliu
@corneliutusnea
Aug 11 2016 04:50
ok, well I'll try with broadcast for now
and fixed size
brb
Aaron Stannard
@Aaronontheweb
Aug 11 2016 04:50
you're better off just allocating a lot of head room
(assuming we're talking lot 10s of actors, not 100s or 1000s)
for one router
Corneliu
@corneliutusnea
Aug 11 2016 05:43
it would be great if there would be a way to determine the real parent of an actor, everything I do now feels like hacks
Aaron Stannard
@Aaronontheweb
Aug 11 2016 05:49
if it were me in your shoes
I would do two things
first, banish constructor-based DI from that area of my project
I don't like it with actors for a littany of reasons, but in this case it's causing a problem for you
I much prefer using factory methods with actors that need disposable resources
Func<IMyIDisposableThing>
because I can abstract over whether I'm using DI or not more easily
second thing I would do is use the direct target pattern and pass in an actor ref into the constructor explicitly
Corneliu
@corneliutusnea
Aug 11 2016 05:51
yeah, it's a bit late to get rid of the DI .. I like it, it's a big part of our project and simplifies a lot of work
I'd prefer that DI is a core part of Akka than get rid of DI
Aaron Stannard
@Aaronontheweb
Aug 11 2016 05:52
I don't like relying on the Context.Parent field inside my actors because it couples how that class is written with how it's deployed
which is bad
Corneliu
@corneliutusnea
Aug 11 2016 05:52
yeah, but I need a way to init an actor with some context. I also don't care about who the parent is, I care that it can tell me some stuff, like an interface
Bartosz Sypytkowski
@Horusiath
Aug 11 2016 06:18
@corneliutusnea looks like your affection to DI has started to hurting you on the very beginning of the development ;)
the problem you're describing is trivial without DI, and using parent instead feels like a hack indeed
Corneliu
@corneliutusnea
Aug 11 2016 06:22
@Horusiath :)
tstojecki
@tstojecki
Aug 11 2016 14:03
akka testkit question - i have been getting the deathwatch warnings even though the tests pass... the tests are pretty straight forward, I do use TestProbe to inject into the actor under test, then assert using ExpectMsg and that works fine... but i can't seem to get to the bottom of what is causing these warnings and i am not sure if this is something i should be worried about
[akka://test/user] DeadLetter from [akka://test/user] to [akka://test/user]: <Received dead system message: <DeathWatchNotification>: [akka://test/user/publisher], ExistenceConfirmed=True, AddressTerminated=False>
Bartosz Sypytkowski
@Horusiath
Aug 11 2016 14:10
@tstojecki It looks like those messages come when you're shutting down your actor system - in that time your actors are getting killed. The reason for that log message is that some of them maybe watched by other actors (i.e. their parents), so when they die, they send notification to watchers. However since the whole world is dying, watchers are too. The result is that they never receive that info (even thou is not necessary at this point), so it lands in dead letters.
tstojecki
@tstojecki
Aug 11 2016 14:17
thanks @Horusiath ... so not much to worry about i guess, just ignore it? I don't have any explicit shutdown commands at the end of the tests, just some ExpectMsg assertions at the end of each test, but i guess Sys is being recycled after each test by the testkit
also, can you help me understand - is this message being sent from /test/user to test/user or from /test/user to /test/user/publisher? I am confused by this warning message
rsinohara
@rsinohara
Aug 11 2016 15:21

Hello everyone... does anyone have any idea why this test passes when I run it alone, but fails when I run every test:

        [Test]
        public void WhenGameIsCreated_SendsGridToUserActors()
        {
            _actor.Tell(new GameActor.NewGameMessage(new List<PlayerData>() { _userData1, _userData2 }));

            _userActorProbe1.IgnoreMessages(m=> m is UserActor.WelcomeToGameMessage);
            _userActorProbe2.IgnoreMessages(m => m is UserActor.WelcomeToGameMessage);

            _userActorProbe1.ExpectMsg<UserActor.GameInitializedMessage>();
            _userActorProbe2.ExpectMsg<UserActor.GameInitializedMessage>();
        }

The error Is that GameInitializedMessage was expected but got a WelcomeToGameMessage instead. So IgnoreMessages are not working... I've had this behavior on another project.
Between calls I am recreating everything that is referenced in the test.

This is the Setup if needed:
        [SetUp]
        public void Setup()
        {
            _userActorProbe1 = CreateTestProbe();
            _userActorProbe2 = CreateTestProbe();
            _proxyActorProbe = CreateTestProbe();

            var props = Props.Create(() => new GameActor(_proxyActorProbe));

            _testActor = ActorOfAsTestActorRef<GameActor>(props);
            _actor = Sys.ActorOf(props);

            _userData1 = new PlayerData("connection ID 1", "user 1", _userActorProbe1,1);
            _userData2 = new PlayerData("connection ID 2", "user 2", _userActorProbe2,2);
        }
NeotericDev
@NeotericDev
Aug 11 2016 18:01
Error Cluster.png
My cluster actors are sending dead letters . Sender IActorRefs are becoming Akka://System/DeadLetters . What could be the issue ?
Damian Reeves
@DamianReeves
Aug 11 2016 18:08
Hey guys
Looks like a bug in the SQLite snapshot store
    public SqliteSnapshotStore(Config snapshotConfig) : base(snapshotConfig)
    {
        var config = snapshotConfig.WithFallback(Extension.DefaultSnapshotConfig);
        QueryExecutor = new SqliteSnapshotQueryExecutor(new QueryConfiguration(
            schemaName: null,
            snapshotTableName: "snapshot",
            persistenceIdColumnName: "persistence_id",
            sequenceNrColumnName: "sequence_nr",
            payloadColumnName: "payload",
            manifestColumnName: "manifest",
            timestampColumnName: "created_at",
            timeout: config.GetTimeSpan("connection-timeout")), 
            Context.System.Serialization);
    }
shouldn't snapshotTableName come from config?
Alex Valuyskiy
@alexvaluyskiy
Aug 11 2016 18:30
Yes, it should
Arjen Smits
@Danthar
Aug 11 2016 20:09
@NeotericDev cluster/remote actors are unregistered ? Not sure when remote actors are changed to deadletters, but that would be my guess. But besides that, we need more information. So how are you registering those actors? Are you using cluster routing, if so what form? Are you using cluster sharding to register those actors? Etc. Just saying, my cluster actors are resolving to deadletters what could be the issue. is like saying: my car wont start, what could be the issue.
Alex Achinfiev
@aachinfiev
Aug 11 2016 21:24
Hi guys. Are there plans to update Akka.Persistence.Cassandra 1.0.6.3-beta to work with latest Akka.Persistence 1.1.1.28-beta? Are changes in 1.1.1.28 release backward incompatible? Thanks.
purifino
@purifino
Aug 11 2016 21:26
damian does that code work? because thats exactly what i need to do LOL???
Damian Reeves
@DamianReeves
Aug 11 2016 21:27
        snapshotTableName: "snapshot",
should be:
snapshotTableName: config.GetString("table-name")),
purifino
@purifino
Aug 11 2016 21:29
i need to generate 1 simple result from a database please help?
public partial class State
{
    public int StateId { get; set; }
    public string StateName { get; set; }
     public string GetState(){
        using (var context = new LocationEntities())
            using var _stateName from State where StateId = 1

            return (_stateName);
    }
}
Chris Martin
@trbngr
Aug 11 2016 21:31
I have a couple of small VMs in azure for lighthouse. What's the secret config to make them accessible? I have the TCP ports open in the firewall and endpoints.
I'm binding to 0.0.0.0
I can't bind to the public IP as that's not a physical interface on the machine
@Aaronontheweb I seem to remember you having this figured out.
purifino
@purifino
Aug 11 2016 21:33
hahaha :P
Maciek Misztal
@mmisztal1980
Aug 11 2016 22:35
@trbngr Here's a checklist I'd follow:
  • Check the network security group in azure portal, to allow traffic to ports exposed by your lighthouse instances
  • Ensure the firewalls allow the traffic at VM level
  • In akka.remote bind the hostname to the internal ip address of the VM (for example: 10.0.0.4)
  • In akka.remote bind the public-hostname to the public IP of the VM
    Let me know if this works for you
Chris Martin
@trbngr
Aug 11 2016 22:52
@mmisztal1980 will give it a whirl this evenin