These are chat archives for akkadotnet/akka.net

2nd
Mar 2017
is there a good way of tracking metadata across actors? I'd like to annotate a message with a requestid and, as that message is handled and other messages are created and passed to other actors, have that requestid automatically tacked on so I can follow the sequence of messages that happen based on a single initial request. I know there are ways I can do it manually, but is there anything that can do this behind the scenes?
Bartosz Sypytkowski
@Horusiath
Mar 02 2017 06:28 UTC
@cduhard currently all sql plugins are pretty bad until batching journals will be an option on corresponding nuget packages. But even then, Cassandra is optimized for high write ratio and I think, if SQL database will beat it there it only means, that our cassandra plugin could be optimized.
Bartosz Sypytkowski
@Horusiath
Mar 02 2017 06:36 UTC
@qwoz you can wrap it with your own envelope, which will contain contextual info, and unwrap it in AroundReceive method i.e:
class Env { 
    public object Message { get; } 
    public RequestContext RequestContext { get; } 

    public Env(object msg, RequestContext ctx) {
        Message = msg;
        RequestContext = ctx;
    }
}

abstract class ContextAwareActor : ReceiveActor {
    protected RequestContext RequestContext;
    protected override void AroundReceive(Receive receive, obj message) {
        var env = message as Env;
        if (env != null) {
            RequestContext = env.RequestContext;
            receive(env.Message);
        } else {
            receive(message);
        }
    }
}

// send message to context-aware actor
actorRef.Tell(new Env(message, Context))
if you will create an actor inheriting from ContextAwareActor it will automatically unwrap request context from passed envelope into RequestContext field before you will handle a message
thanks @Horusiath ... looks like I could also have extension methods for doing Ask or Tell that wraps the context like that automatically. eg: actorRef.ContextTell(message);
Christian Duhard
@cduhard
Mar 02 2017 20:04 UTC
@Horusiath thanks. when you say bad, how bad we talkin'?
Bartosz Sypytkowski
@Horusiath
Mar 02 2017 20:20 UTC
@cduhard hard to say - I've done only some local dev checks and got 450-700 full persistent actor command→event persists. Compared to 9000-12000 of new batching journal, the difference is quite big.
I need to check if everything is ready to go when a new version will be released
Bartosz Sypytkowski
@Horusiath
Mar 02 2017 20:25 UTC
well tbh. SQL is shitty choice for eventsourcing, but we still can get pretty much out of it
Arsene T. Gandote
@Tochemey
Mar 02 2017 20:30 UTC
Hello. I am going to use the Akka.IO to implement some Tcp based protocol. I have read the blog of @Horusiath and the Akka.Net blog. However I have some dark understanding on how I can implement a request/response kind of architecture using the Akka.IO. Any guidance will assist me.
Arsene T. Gandote
@Tochemey
Mar 02 2017 20:38 UTC
The reason I ask the question is to write onto the wire we use Connection.Tell(Tcp.Write.Create...) and to read the response we use Receive<Tcp.Received>. So I would like to know how to map request/response in such a asynchronous manner. Thank you for your assistance
Knowing that the request may not have any tracking number to map to the response as in the case of smpp
to11mtm
@to11mtm
Mar 02 2017 20:47 UTC

@Aaronontheweb I was curious if there was a way to get Helios to throw extended logging around. I'm noticing some odd behavior in my Actors in AWS...

{ "time": "2017-03-02 11:42:29.7716", "level": "WARN", "message": "AssociationError [akka.tcp:\/\/%SystemName%@ec2-xxx-xx-xxx-xx.us-west-2.compute.amazonaws.com:9005] -> akka.tcp:\/\/%SystemName%@yyy.yyy.yyy.yyy:2552: Error [connection timed out: yyy.yyy.yyy.yyy:2552] []" }
{ "time": "2017-03-02 11:42:29.7716", "level": "WARN", "message": "Tried to associate with unreachable remote address [akka.tcp:\/\/%SystemName%@yyy.yyy.yyy.yyy:2552]. Address is now gated for 5000 ms, all messages to this address will be delivered to dead letters. Reason: [connection timed out: yyy.yyy.yyy.yyy:2552] " }
{ "time": "2017-03-02 11:42:29.7716", "level": "INFO", "message": "Message CommandResponse from akka:\/\/%SystemName%\/user\/userPreferences\/$q\/specificPreferenceHandler\/$x to akka:\/\/%SystemName%\/deadLetters was not delivered. 1 dead letters encountered." }

%SystemName%, IP addresses, and app-specific actornames are obfuscated for security. What's happening is my Backend process (The one on port 9005) gets a Command from the Website Frontend (The one on port 2552). It processes the command, but when it tries to 'respond' to the frontend, that error happens.

What's a little odd is restarting the Backend process causes the problem to go away for an undetermined period of time. I'm fairly certain this is some sort of AWS specific thing since we don't have these problems at all on the ground.

Aaron Stannard
@Aaronontheweb
Mar 02 2017 20:50 UTC
hmmm
timeout eh
Arsene T. Gandote
@Tochemey
Mar 02 2017 20:51 UTC
@Aaronontheweb Please any idea on my post?
Aaron Stannard
@Aaronontheweb
Mar 02 2017 20:51 UTC
let me check if that's a socket error
or an akka.remote error
are you using Elastic IPs or anything like that?
or are all of your connections done using the Private IPs (actual IP allocated to machine via DHCP) ?
@Tochemey you need some help figuring out how to work with Akka.IO?
Arsene T. Gandote
@Tochemey
Mar 02 2017 20:52 UTC
@Aaronontheweb Okay
Aaron Stannard
@Aaronontheweb
Mar 02 2017 20:53 UTC
I'm about to step out for a bit to run some errands but if you could give me some more specifics I'd be happy to help
Arsene T. Gandote
@Tochemey
Mar 02 2017 20:53 UTC
Okay I will do that
to11mtm
@to11mtm
Mar 02 2017 20:54 UTC
FWIW.... they are both the 'public' IPs, although neither of the machines are rebooting in any of this. I'm pushing out a change to where we will be using the Private IP instead on the frontend (and potentially the backend as well, although I'm somewhat less concerned since the backend always gets the message just fine)
Will let you know whether that improves anything, but figured I'd see if you had any ideas. Also searching for issues related to this, I saw something implying you had samples for getting the data from AWS APIs to set public-hostname, (https://github.com/akkadotnet/akka.net/issues/796#issuecomment-90187995) and was curious if those were publicly available.
Christian Duhard
@cduhard
Mar 02 2017 22:30 UTC
@Horusiath I knew it was likely shitty. I am curious how shitty. I'm using EventStore for another project, this one has a different footprint, thousands of streams per day, 10s of millions of events/d, peak ingress would be 200-300 events/s
this one is also going in azure
Corneliu
@corneliutusnea
Mar 02 2017 22:35 UTC
Guys, one of my Akka systems started to crash with this
Object reference not set to an instance of an object. akka://Name/user/OneActor System.NullReferenceException: Object reference not set to an instance of an object. at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message) at Akka.Actor.ActorCell.ReceiveMessage(Object message) at Akka.Actor.ActorCell.Invoke(Envelope envelope)
I have thousands of these in the logs
Aaron Stannard
@Aaronontheweb
Mar 02 2017 22:57 UTC
@corneliutusnea were you able to send a null message to the actor somehow?
or have a predicate function on a Receive<T> that tried to check a null property?\
@to11mtm no unfortunately I don't have access to that source anymore since I did that work at my previous company
but the AWS SDK in C# exposed a static method at that time for EC2 VMs
that would give you the VMs private IP address
Corneliu
@corneliutusnea
Mar 02 2017 22:58 UTC
@Aaronontheweb Not really .. that actor is one of the simplest actors I have and nobody sends anything to it
Aaron Stannard
@Aaronontheweb
Mar 02 2017 22:58 UTC
so I just injected that into the HOCON configuration
Corneliu
@corneliutusnea
Mar 02 2017 22:59 UTC
there is a Context.System.Scheduler.ScheduleTellRepeatedlyCancelable and that's about it
Ill see if maybe I send some nulls but I'm not sure where from I could do that
Aaron Stannard
@Aaronontheweb
Mar 02 2017 22:59 UTC
ohhhhh
do you cancel the task when the actor stops?
well actually
that wouldn't do it
it'd get deadletter'd
this error comes from something inside the actor's receives hitting a NRE
Corneliu
@corneliutusnea
Mar 02 2017 23:00 UTC
I never stop the actor
it's a background scheduler checking some stuff in the background every 2-3 seconds
I'll see about nulls as someone else is sending some messages to it
Aaron Stannard
@Aaronontheweb
Mar 02 2017 23:01 UTC
that could be it
check out if there's a property of some message that shouldn't be nullable
but is in this instance
@to11mtm reason why I brought up the public IPs thing
possible, especially in the last 48 hours with all of the issues AWS had
that the infrastructure that AWS uses for Elastic IPs could have had a reset of some sort
since that service sits outside of the VMs themselves and does a sort of port forwarding
I never had that issue when I was using it
but AWS had a bunch of outages and service interruptions in their major US-East data center this week
I had one endpoint that I had to access that way
Aaron Stannard
@Aaronontheweb
Mar 02 2017 23:06 UTC
but usually I just went straight for the private IP and formed a direction connection