These are chat archives for akkadotnet/akka.net

6th
Jun 2015
Roger Johansson
@rogeralsing
Jun 06 2015 06:30
hmm. so you want to sort of suspend the worker for that hash?
and keep processing on all the other workers?
Chris Martin
@trbngr
Jun 06 2015 08:51
Akka.Persistence is like fuckin magic! I can't get over how much code I can throw away. Holy shit!
Roger Johansson
@rogeralsing
Jun 06 2015 09:26
:)
NeoDarque
@NeoDarque
Jun 06 2015 16:13
If I have a simple actor deriving from UntypedActor and the actor throws an exception in the OnReceive method, shouldn't the message that caused this show up in the PreRestart(Exception reason, object message) override? I'm just getting null in the message parameter. (this is Akka.Net v1.0.2), or should I be using some other override if I want to do something with this bad message?
Roger Johansson
@rogeralsing
Jun 06 2015 16:55
@NeoDarque can you post a gist, that is not supposed to happen and that is not what Im seeing here
Roger Johansson
@rogeralsing
Jun 06 2015 17:21
prerestart.png
im getting both the exception and the message just fine
Roger Johansson
@rogeralsing
Jun 06 2015 17:27
hmmm. i think you are right
it seems to be something funky going on with consistent hashrouter and restarts
NeoDarque
@NeoDarque
Jun 06 2015 17:30
Odd thing that you seem to be getting the message, I'm just getting null every time.
Roger Johansson
@rogeralsing
Jun 06 2015 17:31
this is def a bug... the restart is sent to the wrong actor :|
NeoDarque
@NeoDarque
Jun 06 2015 17:32
And it's the fact that I'm using that specific router that triggers the bug?
Roger Johansson
@rogeralsing
Jun 06 2015 17:36
meh, im just tired :) the default router supervisionstrategy is to escalate to the router parent. so the entire router is restarted and then all the children is restarted too.. thus you will see multiple prerestarts. some with null messages as those workers have not yet had any messages
var props = Props.Create<SubscriberActor>().WithRouter(new Akka.Routing.ConsistentHashingPool(5).WithSupervisorStrategy(SupervisorStrategy.DefaultStrategy));
change your code to that. then the router itself will try to restart any failing children
that is. by adding .WithSupervisorStrategy(SupervisorStrategy.DefaultStrategy) the router can restart children, otherwise it will just escalate to its own parent
NeoDarque
@NeoDarque
Jun 06 2015 17:42
Ok, thanks Roger! The documentation says "By default, routers use the OneForOneStrategy, so if a child dies, only that actor is restarted." though.
Roger Johansson
@rogeralsing
Jun 06 2015 17:44
thanks, ill look into that
NeoDarque
@NeoDarque
Jun 06 2015 17:45
Works just fine now for me too. :smile: Btw, really like this project, thanks for all the effort you guys are putting into it!
Roger Johansson
@rogeralsing
Jun 06 2015 17:45
    /// <summary>
    ///     When supervisorStrategy is not specified for an actor this
    ///     is used by default. OneForOneStrategy with a decider which escalates by default.
    /// </summary>
    public static SupervisorStrategy DefaultStrategy
    {
        get { return new OneForOneStrategy(10, TimeSpan.FromSeconds(10), ex => Directive.Escalate); }
    }
it is using the one for one strategy but it will always escalate. thus making the router itself restart, which in turn recreates all its workers.. ill have a look at scala and see if escalate is the default directive there too
object Pool {
  val defaultSupervisorStrategy: SupervisorStrategy = OneForOneStrategy() {
    case _ ⇒ SupervisorStrategy.Escalate
  }
}
yepp, same there.. but I do agree that the wording in the docs are confusing as it will end up escalating and do a full restart
NeoDarque
@NeoDarque
Jun 06 2015 17:50
It's always easier once you know how it works. :smile:
I like the dynamically resizable pools, but just wondering if it's possible to change the upper bound programmatically also during runtime?
Roger Johansson
@rogeralsing
Jun 06 2015 17:59
no there is not... your best bet in that case would be to write your own resizer