These are chat archives for akkadotnet/akka.net

3rd
Feb 2016
Mikey
@BrainSlugs83
Feb 03 2016 01:51
Hey guys -- using Akka Clustering -- when I assign port 0 (to a non-seed node) and it generates a random port -- what happens? -- Where does that port come from? (Like, can I see it in the source somewhere? -- I've been searching but having a hard time finding it).
Mostly -- I want to know if it's possible to restrict that port to a specific range (and if not, where in the code can I see that?).
y-vasilyev
@y-vasilyev
Feb 03 2016 04:34
Hi, @/all! Could you help me - can't find out what to do with fault tolerance. Assume I have Web API and Akka host (Win Service). I send 100 messages from web api to Host. Actor processed 50 messages from mailbox, then host process crashes. How-to recover mailbox of actor? Is there any examples? I assume, that Akka.Persistance doesnt help, as messages was not processed by actor?
Christian Sparre
@christiansparre
Feb 03 2016 05:23
@BrainSlugs83 we had a similar question a few months back, as I remember it the OS provides the port, and there are no "code" i Akka.net that generates it. We ended up using an HttpListener to reserve our selves a number of ports in a high range that we can provide when needed. Our problem was that if you give akka a port that it cannot use, we had a really hard time finding out. No catchabel exepction if I remember, the remote part of akka just did not work...
Mikey
@BrainSlugs83
Feb 03 2016 05:42
@christiansparre -- that's kind of lame -- I have to tell OPs what ports to open in the firewall -- and for our transient nodes, they really need a port to be in a given range.
(@christiansparre -- thanks for the info though!) :-)
voltcode
@voltcode
Feb 03 2016 06:47
@BrainSlugs83 don't use random ports because you won't be able to rejoin the cluster after failure.
You should use static ports and if it doesn't suffice some kind of config bootstrapped that'll generate ports in a stable manner
*config bootstrapper
voltcode
@voltcode
Feb 03 2016 06:53
@Aaronontheweb see this is an example of what I had in mind when talking about knowledge base. When gitter is the first place to look for new users, our searchable and indexable knowledge base doesn't grow. I'm not anti status quo,but wish to find a way to give akka.net more exposure (and hopefully more contributors in the end)
Arjen Smits
@Danthar
Feb 03 2016 07:29
@BrainSlugs83 @christiansparre is right. The OS provides the port.
John Nicholas
@MrTortoise
Feb 03 2016 08:12
@voltcode I think the point in return was simply that gitter doesn't have a good api for that and also SO has far more invested into solving that problem really well (along with developers having a very high awareness of SO existence). Eg the question here can easily be asked and answered on SO ... tbh most of my questions on there i end up answering, because if the answer isn't on there already its usually because noone has run into the precise problem i have so i solve it before anyone else.
Moreover its permanence is higher than blogs
last time i checked the only akka.net questions on there that were not answered were not appropiate format for SO (irrc think that was azure vs aws)
voltcode
@voltcode
Feb 03 2016 09:52
@MrTortoise SO is totally fine by me. The problem I see now is that it is too easy to ask a question on gitter, get a meaningful response (this is great btw!). However, time invested by the asking and responding person does not provide longer-term return for the project because gitter does not provide search and indexing by google. Maybe it's enough if we kindly ask people to use SO for new akka.net questions ? I'm pretty sure this is a problem for other open source projects that use gitter daily.
I had a Akka question today, was initially tempted to post it here but used SO instead. We'll see how it works :), I start the change from myself.
John Nicholas
@MrTortoise
Feb 03 2016 10:01
yeah i agree with lots and lots of valuable info appearing on here that vanishes into the ether. Its the main reason why i sit on here and catch up daily. I'd agree with gentle encouragement, seems more than reasonable to me.
voltcode
@voltcode
Feb 03 2016 10:28
hah that's exactly why I read the scrollback daily too :)
John Nicholas
@MrTortoise
Feb 03 2016 10:34
the search function in here is dire though ... i am sure someone mentioned considering removing sender from the arguments of tell ... but i cant find it
Roger Johansson
@rogeralsing
Feb 03 2016 10:57
maybe frequently asked questions could be aggregated and added to a special section of the documentation site
Arjen Smits
@Danthar
Feb 03 2016 11:11
an FAQ for the website would be a good idea.
Michel van den Berg
@promontis
Feb 03 2016 11:29
What about a wiki
Jens Pettersson
@jenspettersson
Feb 03 2016 11:32
I've got a project with a couple of hundred unit tests using the TestKit and I can't seem to turn off logging when running the tests. I've not added any loggers to the unit test project and I've tried to set the stdout-loglevel = ERROR and loglevel = ERROR in the test projects app.config, but nothing seems to work. The annoying thing is that our CI servers build log (that also runs the tests) gets flooded with akka warnings (mostly warnings about DeathWatchNotifications).
Any ideas?
Chris Ray
@chris-ray
Feb 03 2016 11:53
@christiansparre Re: EventStore: I put event store v2 in a fairly complex production system in March 2014. Having not used Akka.net for that project, the ES is to this day the most stable part of that system.
donmikel
@donmikel
Feb 03 2016 12:41
When I send a PoisonPill to parent, child actors will not get the PoisonPill from the parent, they will simply stopped. This is true?
Roger Johansson
@rogeralsing
Feb 03 2016 12:43
@donmikel yes, parent will start a recursive teardown of children
donmikel
@donmikel
Feb 03 2016 12:46
Hm, not good. Have to manually make the cascade spread PoisonPills
JA Reyes
@jarDotNet
Feb 03 2016 12:46
Hi there. I have a new newbie question...
Roger Johansson
@rogeralsing
Feb 03 2016 12:46
why do they need poison pill explicitly?
donmikel
@donmikel
Feb 03 2016 12:48
@rogeralsing I have actors hierarchy, and then the parent get PoisonPill, сhildren can have a lot of messages in the mailbox and I have to process them before stopping
JA Reyes
@jarDotNet
Feb 03 2016 12:48
In a Coordinator actor, I have a SupervisorStrategy and I add a break point in a Repository that throws an exception
Here is my code:
protected override SupervisorStrategy SupervisorStrategy()
{
    return new OneForOneStrategy(
        maxNrOfRetries: 10,
        withinTimeRange: TimeSpan.FromSeconds(30),
        localOnlyDecider: ex => {

            Context.Parent.Tell(new Failure { Exception = ex });
            return Directive.Stop;
        });
}
If I understand well this code, I expected 10 stops at my break point, but I only have 1 stop
Should this strategy try to call my repository method 10 times?
Roger Johansson
@rogeralsing
Feb 03 2016 12:52
It will only hit one time per exception, for a maximum of 10 times then the actor will be killed instead
but in this case retries are pointless as you do return Stop, so it will be killed every time
retries means, use this policy for 10 times over 30 seconds, and if it fails 11 times during this 30 sec interval, kill it
@donmikel ok, are the children only receiving messages from the parent? otherwise, how do you know that there wouldnt be other messages enqueued after the poisonpill?
donmikel
@donmikel
Feb 03 2016 12:55
@rogeralsing yes, only from parent
Roger Johansson
@rogeralsing
Feb 03 2016 12:57
ok, you could replace the poisonpill to the parent with a custom message that then send poisonpill to all children, once all children are dead, terminate itself
JA Reyes
@jarDotNet
Feb 03 2016 12:58
Ok, so if I wanted to retry the repository query I should manage the Failure message at the Coordinator Parent, shouldn't I?
Roger Johansson
@rogeralsing
Feb 03 2016 13:05
If you want to retry as in do the same thing x times, you need to apply that logic yourself, or use a lib like Polly https://github.com/App-vNext/Polly
JA Reyes
@jarDotNet
Feb 03 2016 13:07
Tkx, We misunderstand the documentation in this case
donmikel
@donmikel
Feb 03 2016 13:07
@rogeralsing thanks, I'm doing something like this
Roger Johansson
@rogeralsing
Feb 03 2016 13:15
@donmikel this should sort of do it https://gist.github.com/rogeralsing/6ea258a552b3f3c2fc27 that is only one level deep, but I hope you get the idea
donmikel
@donmikel
Feb 03 2016 13:16
@rogeralsing thanks
Roger Johansson
@rogeralsing
Feb 03 2016 13:19
Once the parent gets the "terminate" message, it will poison pill its children, then it will switch state so it can no longer accept any more messages, and wait for all children to die and then kill itself
donmikel
@donmikel
Feb 03 2016 13:19
@rogeralsing one more question, if i send PoisonPill to router, the routee will also be simply stopped or get a pill?
Vlad Kosarev
@vladkosarev
Feb 03 2016 13:20
is there a writeup/video of akka-based app upgrade/deployment story in a cluster environment?
John Nicholas
@MrTortoise
Feb 03 2016 13:21
@rogeralsing when you create an actor from within another actor (so parent creates child) doesnt the Terminated message goto the parent even if you do not watch it?
@rogeralsing don't worry, ill just test lol
Roger Johansson
@rogeralsing
Feb 03 2016 13:23
@MrTortoise it doesnt, not sure if that is an oversight or not, but the user receive handler will not get the Terminated message unless it have explicitly watched the child. I need to verify with scala too
(it will however get the deatwatch to remove the child from the collection even if you dont watch it
John Nicholas
@MrTortoise
Feb 03 2016 13:24
was more testing my understanding of supervision heirachy. Ive never done anything that required it directly so wasnt sure
ahh ok
This message was deleted
Vlad Kosarev
@vladkosarev
Feb 03 2016 13:29

another question, is it possible to rename your actor on the fly (right now I terminate/recreate)? Use case here is coordinator getting a 'new item' request and spinning up a new child actor but the Id for that item/actor will be given once the database write succeeds. So temporarily we create a GUID actor but we want it addressable by its Id (let's say order id) later on.

This way of thinking seems wrong but I'm not sure yet what the correct way of dealing with this is.

Roger Johansson
@rogeralsing
Feb 03 2016 13:30
@donmikel if you send a poisonpill to the router it will consume the pill in the router cell, and kill the children
@vladkosarev does the actor need to exist before it has been written to disc?
Vlad Kosarev
@vladkosarev
Feb 03 2016 13:32
@rogeralsing only to create the initial record of itself in the data store
Roger Johansson
@rogeralsing
Feb 03 2016 13:32
@vladkosarev otherwise you could have some DB writer actor that does the writing and once it is written, the child with the correct id is created..
Vlad Kosarev
@vladkosarev
Feb 03 2016 13:34
@rogeralsing ah, so just have a 'worker' type actor that creates the record and returns to coordinator and then coordinator spins up a new actor with correct id? Might be a bit cleaner than self-destruct actors I have right now. Thanks
Roger Johansson
@rogeralsing
Feb 03 2016 13:34
exactly
Vlad Kosarev
@vladkosarev
Feb 03 2016 13:34
I'll try that, thanks!
while you are here, is there any documentation on doing upgrades within a cluster with no downtime? Something like service fabric?
Roger Johansson
@rogeralsing
Feb 03 2016 13:38
I dont think there is anything written on that yet, the JVM guys might have something on their end.. but in general I'd say the easiest way would be to do canary releases. e.g. you have 10 instances of Worker v1 deployed.. you now want to deploy worker v2. then kill a few instances of v1, e.g. 3 so you still have 7 v1 running... deploy 10 instances of v2 so they run side by side.. then kill of the rest of the v1 nodes
Vlad Kosarev
@vladkosarev
Feb 03 2016 13:39
That's what I figured, just wanted to make sure I wasn't missing some built-in mechanism. Thank you
donmikel
@donmikel
Feb 03 2016 13:39
@rogeralsing do not quite understand, routee will receive a pill or are stopped?
Roger Johansson
@rogeralsing
Feb 03 2016 13:41
stopped
donmikel
@donmikel
Feb 03 2016 13:42
thanks
Roger Johansson
@rogeralsing
Feb 03 2016 13:42
@vladkosarev that being said, @Aaronontheweb was toying around with isolated appdomains and remote code deployment a few days ago.. that could enable true code hotloading... but I suspect the performance overhead would be too big in most cases
Michel van den Berg
@promontis
Feb 03 2016 13:43
I think canary releases would be best
a friend of mine did this with integration with slack and could update the load balancer and releases with it
the deployment process would ask if everything in the new project is going ok
Michel van den Berg
@promontis
Feb 03 2016 13:50
if you type 'no' it would roll back, otherwise it will continue loading the new instances and kill some others
until everything is deployed
also, the load balancer would only transfer some percentage of users to the new instances
Vlad Kosarev
@vladkosarev
Feb 03 2016 13:57
@promontis yeah, that makes sense, chatops ftw
@rogeralsing I saw Aaron talking about it but it did sound like .net was in the way of this type of functionality
Bartosz Sypytkowski
@Horusiath
Feb 03 2016 13:58
@donmikel you may poison pill routees by sending Broadcast(PoisonPill) to router - it will distribute that message to all of it's routees
donmikel
@donmikel
Feb 03 2016 13:59
@Horusiath thanks
donmikel
@donmikel
Feb 03 2016 14:09
if i subscrube by Context.Watch(actor) to router, I get a Terminated message when all routees will be stopped?
Bartosz Sypytkowski
@Horusiath
Feb 03 2016 14:15
not sure, but I wouldn't count on that
EGirardi
@EGirardi
Feb 03 2016 15:38

Hello - New to Akka (still) and getting an error trying to setup a router using the config file method. What am i doing wrong ? All the examples I see don't show a full akka.config file so I'm not 100% sure how to format the settings for a router in there : An exception of type 'Akka.Configuration.ConfigurationException' occurred in Akka.dll but was not handled in user code
Additional information: Configuration problem while creating [akka://MacActorSystem/user/MsgTakerActor/$b/CustomerFunctionsActor] with router dispatcher [akka.actor.default-dispatcher] and mailbox and routee dispatcher [akka.actor.default-dispatcher] and mailbox []. My config file looks like this: akka {
stdout-loglevel = INFO
loglevel = INFO
log-config-on-start = on
loggers = ["HttpListenerServer.NLogLogger,HttpListenerServer"]
}

akka.actor.deployment {
/CustomerFunctionsActor {
router = round-robin-pool
nr-of-instances = 5
}
} My line of code looks like this: var props = Props.Create<CustomerFunctionsActor>().WithRouter(FromConfig.Instance);
CustomerActorRouter = Context.ActorOf(props, "CustomerFunctionsActor");

Amon-Ra Mackie
@nevaenuf
Feb 03 2016 15:42
Is there a way to provide a naming strategy for children created by routers?
Alex Achinfiev
@aachinfiev
Feb 03 2016 16:06
@EGirardi I think you need to specify deployment with the full path to actor. I.e. instead of just /CustomerFunctionsActor it should be: "/MsgTakerActor/*/CustomerFunctionsActor" {}
Christian Duhard
@cduhard
Feb 03 2016 16:37
What might be going on here? I am seeing these messages fill up my logs and service requires a restart.
2016-02-03 10:20:59.056 -05:00 [Debug] Resolve of path sequence [/"user/$c/coordinator/contact-pool/$e"] failed
Bartosz Sypytkowski
@Horusiath
Feb 03 2016 16:41
@nevaenuf no, they are used mostly for parallelization
@cduhard can you provide some wider context?
Christian Duhard
@cduhard
Feb 03 2016 16:43
well, i have a persistent actor that has a round-robin pool of workers e.g. "user/$c/coordinator/contact-pool/$e"
all of a sudden the logs fill up with those debug messages and no messages are going through
it's intermittent, just hoping for a place to look for an issue
Bartosz Sypytkowski
@Horusiath
Feb 03 2016 16:46
usually having subsequent anonymous actor names is not good strategy when it comes to resolving actors by path
Christian Duhard
@cduhard
Feb 03 2016 16:46
the last log message I see before i get 50MB of that Resolve issue is "2016-02-03 07:30:27.310 -05:00 [Debug] Found snapshot of "account-602432"
i am not resolving actors by path
Bartosz Sypytkowski
@Horusiath
Feb 03 2016 16:46
are you using AtLeastOnceDelivery?
Christian Duhard
@cduhard
Feb 03 2016 16:46
nope
local actor system obv.
Bartosz Sypytkowski
@Horusiath
Feb 03 2016 16:47
ok, so I still have not enough details to help :P
Amon-Ra Mackie
@nevaenuf
Feb 03 2016 16:47
@Horusiath thanks.
Bartosz Sypytkowski
@Horusiath
Feb 03 2016 16:48
could you describe actors over that path?
Christian Duhard
@cduhard
Feb 03 2016 16:48
it's a round robin pool of actors that does db lookups for the persistent actor
it's shared across instances
it's created by the coordinator
each actor in that pool has its own workers for doing db updates etc
this just started after updating to 1.0.6. There were other changes alongside that update, so I can't say it's related to 1.0.6
Christian Sparre
@christiansparre
Feb 03 2016 17:47
How would one go about testing if a parent actor creates a child actor when it receives a message?
Chris Martin
@trbngr
Feb 03 2016 17:53
@christiansparre Many ways. The child could send a message to the event-stream, you could use set it as a property and use ActorOfAsTestActorRef to create the parent in your test and check the .UnderlyingActor property, etc...
Christian Sparre
@christiansparre
Feb 03 2016 17:54
Ok, I'll look into that, would be nice if the TestKit could track what actors were created etc...
Setting a property or sending a message onto the event-stream just for the test does not sound right to me...
alexgoeman
@alexgoeman
Feb 03 2016 17:56
Security related question: How would one go about (best practives) associating some security related information with each message received remotely, so actor can do authorization checks (based on some claims about origin,user account,...) . I'm finding very little info around the subject. Perhaps I'm not approaching it the right way ? Thing is I have some akka.net actorsystem running on the desktops of the users and would like to implement some authorization on the server actorsystem. Thanks in advance
Marc Piechura
@marcpiechura
Feb 03 2016 18:25
@christiansparre you could use an ActorSelection with ResolveOne to see if the child actor exists, if you know it's name
Marc Piechura
@marcpiechura
Feb 03 2016 18:30
Or you provide a factory func to the parent which creates the child actor which you can override in the test
Chris Martin
@trbngr
Feb 03 2016 18:32
yup...many ways. I think I'd opt for ActorSelectioninstead of changing code to satisfy tests.
Sean Gilliam
@sean-gilliam
Feb 03 2016 19:04
@EGirardi, it looks like your config is a bit wonky. Perhaps try the following config:
akka {
  stdout-loglevel = INFO
  loglevel = INFO
  log-config-on-start = on
  loggers = ["HttpListenerServer.NLogLogger,HttpListenerServer"]
  actor {
    deployment {
      /CustomerFunctionsActor {
        router = round-robin-pool
        nr-of-instances = 5
      }
    }
  }
}
Christian Duhard
@cduhard
Feb 03 2016 20:09
@Horusiath i think it might be crashing when this is called..
protected override void PostStop() { Context.IncrementActorStopped(); }
i noticed >System.NullReferenceException: Object reference not set to an instance of an object.
Christian Duhard
@cduhard
Feb 03 2016 20:22
now that I actually think about that, is the Context null there?
1razieh
@1razieh
Feb 03 2016 21:17
Hi I just start a simple project with Akka and I add it to existing API and it when I want to run it give me this error: Could not enumerate all types for 'C:\Api.Server\bin\Akka.dll If any body can help me I appreciate it
John Nicholas
@MrTortoise
Feb 03 2016 21:21
roughly how long does build all take?
1razieh
@1razieh
Feb 03 2016 21:22
@MrTortoise it dosen't take too much
John Nicholas
@MrTortoise
Feb 03 2016 21:45
30 mins is the answer to that one
John Nicholas
@MrTortoise
Feb 03 2016 21:50
are there intermittent failures on persistence?