These are chat archives for akkadotnet/akka.net

10th
Jun 2016
Chris Constantin
@cconstantin
Jun 10 2016 00:24
@ilhadad I wonder if the issue is with ReceivePersistentActor
It will probably be a fair bit of work, but can you try extending from PersistentActorinstead, and see if that works?
ilhadad
@ilhadad
Jun 10 2016 00:52
What's weird is that this code was working before. It's ignoring all Commands.
ilhadad
@ilhadad
Jun 10 2016 01:09
Reduced the code next to nothing and it still does not receive a command. Is there a bug here?
public class ClientListActor : ReceivePersistentActor
    {
        private ILoggingAdapter _logger = Context.GetLogger();
        public override string PersistenceId { get; } =  Context.Self.Path.Name;
        ClientListState _ActorState;

        // This dictionary holds all the recovery command handlers that this actor will process
        Dictionary<string, Action<Command>> UseRecoveryCommandHandler;

      public ClientListActor()
        {
            //Set up the command handlers
            UseRecoveryCommandHandler = new Dictionary<string, Action<Command>>();

            // Set up a state object
            _ActorState = new ClientListState(PersistenceId, _ActorType);

            // Put actor in recovering state
            Recovering();
        }

        private void Recovering()
        {
            try
            {
                _logger.Debug($"Setting Up Persistence Actor with persistence id: {PersistenceId}");

                Recover<RecoveryCompleted>(rc =>
                {
                    _logger.Info("Recovery Complete.", Self.Path.ToStringWithAddress());
                });
                CommandAny(o=> { _logger.Debug(o.ToString()); });
                _logger.Debug($"Completed set-up of persistence actor persistence id: {PersistenceId}");

            }
            catch (Exception ex)
            {
                _logger.Error("Something went really bad during recovery.");
            }

        }
}
qwoz
@qwoz
Jun 10 2016 03:09

When it comes to using actor references, my current approach can be summed up as:

  • if there's a hard dependency on another actor, pass it in via the constructor
  • if it's a fire-and-forget soft dependency, put it into the static actor reference class

I haven't yet found a need to use an actor selection string... but maybe there's a use case (eg: clustering) I just haven't run into? Is that about right, or is there a better approach to where actors are referenced from?

Bartosz Sypytkowski
@Horusiath
Jun 10 2016 05:54
@ilhadad could you create a whole sample of it and link here?
@qwoz if it's soft "one-time" dependency, you can pass actor ref with message itself
qwoz
@qwoz
Jun 10 2016 16:38
Thanks @Horusiath
ilhadad
@ilhadad
Jun 10 2016 16:50
How can I get granular logging as to what the Akka system is doing?
It's getting stuck while instantiating the actor system.
inside the akka.debug HOCON section
ilhadad
@ilhadad
Jun 10 2016 16:56
Got it thanks. Here's what I am getting...
2016-06-10 12:56:09.5295|INFO|EY.SSA.ActorSystemHost.Program|Version:C# Build: 1.0.0.0
2016-06-10 12:56:09.6325|INFO|EY.SSA.ActorSystemHost.Program|Starting SSA Actor System at ActorSystemHost at:CF_IHadad
2016-06-10 12:56:09.8326|DEBUG|Akka.Event.EventStream|Logger log1-NLogLogger [NLogLogger] started
2016-06-10 12:56:09.8326|DEBUG|Akka.Event.EventStream|StandardOutLogger being removed
2016-06-10 12:56:09.8426|DEBUG|Akka.Event.EventStream|Default Loggers started
2016-06-10 12:56:09.8926|INFO|Akka.Event.DummyClassForStringSources|Starting remoting
2016-06-10 12:56:09.9081|DEBUG|Akka.Event.DummyClassForStringSources|Starting prune timer for endpoint manager...
2016-06-10 12:56:09.9476|ERROR|Akka.Actor.OneForOneStrategy|Method 'Configure' in type 'Akka.Remote.Transport.Helios.TcpServerHandler' from assembly 'Akka.Remote, Version=1.0.6.16, Culture=neutral, PublicKeyToken=null' does not have an implementation.
2016-06-10 12:56:09.9476|ERROR|Akka.Event.DummyClassForStringSources|Remoting system has been terminated abrubtly. Attempting to shut down transports
2016-06-10 12:56:09.9476|DEBUG|Akka.Event.DummyClassForStringSources|Starting prune timer for endpoint manager...
Aaron Stannard
@Aaronontheweb
Jun 10 2016 16:57
did you upgrade to Helios 2*?
ilhadad
@ilhadad
Jun 10 2016 16:57
checking
Aaron Stannard
@Aaronontheweb
Jun 10 2016 16:57
because that's exactly what would cause that initialization failure
ilhadad
@ilhadad
Jun 10 2016 16:58
2.1.1
what should it be?
Aaron Stannard
@Aaronontheweb
Jun 10 2016 16:58
downgrade to 1.4.1
ilhadad
@ilhadad
Jun 10 2016 16:58
thanks
Aaron Stannard
@Aaronontheweb
Jun 10 2016 16:58
1.4->2 has breaking changes
which is why I bumped the version number
Akka.NET 1.1 will be compiled to work against 2.1
Alex Valuyskiy
@alexvaluyskiy
Jun 10 2016 17:03
@Aaronontheweb what exactly you have changed in routers? I'm planning to change FromConfig and RouterConfig/Pool/Group classes. Have you touched them?
Aaron Stannard
@Aaronontheweb
Jun 10 2016 17:03
haven't touched any of those
just the RoutedActorCell and the Resizer
Alex Valuyskiy
@alexvaluyskiy
Jun 10 2016 17:03
thanks
Aaron Stannard
@Aaronontheweb
Jun 10 2016 17:03
anything that touched the mailbox / dispatcher basically
Alex Valuyskiy
@alexvaluyskiy
Jun 10 2016 17:03
You could take my resizer tests from my PR. I will exclude them from my PR
Alex Valuyskiy
@alexvaluyskiy
Jun 10 2016 17:21
@Aaronontheweb could I use C# 6.0 in Akka code?
Aaron Stannard
@Aaronontheweb
Jun 10 2016 17:22
yep
Alex Valuyskiy
@alexvaluyskiy
Jun 10 2016 17:22
nice
Aaron Stannard
@Aaronontheweb
Jun 10 2016 17:22
one caveat is try to avoid using the C# property syntax on anything that might get serialized
JSON.NET had some issues wiht that
although that may be fixed
in the latest version
Bartosz Sypytkowski
@Horusiath
Jun 10 2016 17:23
@Aaronontheweb readonly props were fixed in json.net 8.0
Alex Valuyskiy
@alexvaluyskiy
Jun 10 2016 17:23
I've used C# 6 auto-properties everywhere in my application code and didn't have any problems
Aaron Stannard
@Aaronontheweb
Jun 10 2016 17:23
sounds like they should be fine then
Stanley Goldman
@StanleyGoldman
Jun 10 2016 19:22
So if i use Ask<>() with a BroadcastPool, which pool item's response am i getting?
Aaron Stannard
@Aaronontheweb
Jun 10 2016 19:22
whoever responds first
Stanley Goldman
@StanleyGoldman
Jun 10 2016 19:22
but the task wont end until all actors in the pool respond?
Aaron Stannard
@Aaronontheweb
Jun 10 2016 19:22
Ask on a broadcast pool is basically scatter gather first completed
task ends when the first responds
Ask is greedy
Stanley Goldman
@StanleyGoldman
Jun 10 2016 19:24
is there a way to do what i'm looking for that i'm missing?
Aaron Stannard
@Aaronontheweb
Jun 10 2016 19:24
you want to get a response from all actors in the pool?
Stanley Goldman
@StanleyGoldman
Jun 10 2016 19:25
yea
Aaron Stannard
@Aaronontheweb
Jun 10 2016 19:25
ok
in order to make that work, no matter how you want to do it
you need to know how many routees there are underneath the router
because that determines when the job is "done"
so an easy way of doing this
is to send a GetRoutees message to the router
which will reply back with Routees
Stanley Goldman
@StanleyGoldman
Jun 10 2016 19:26
ahh
Aaron Stannard
@Aaronontheweb
Jun 10 2016 19:26
and that contains a list of all of the underlying actors
Stanley Goldman
@StanleyGoldman
Jun 10 2016 19:26
okay, i got it now
Aaron Stannard
@Aaronontheweb
Jun 10 2016 19:26
and then you can iterate over that
:+1:
Stanley Goldman
@StanleyGoldman
Jun 10 2016 19:27
thanks man
Aaron Stannard
@Aaronontheweb
Jun 10 2016 19:27
anytime
frasermolyneux
@frasermolyneux
Jun 10 2016 19:56
@Aaronontheweb thanks for your comments on Azure - I have had little success. My next investigation will be using the actor system within a TopShelf setup and release management to handle the continuous deployment - hopefully will get further
Aaron Stannard
@Aaronontheweb
Jun 10 2016 19:59
Topshelf and Windows Services are a better setup for Akka.NET clusters
I'd only ever keep an Akka.NET node inside an IIS application if app pool recycling was totally disabled
which I've done before successfully at scale
although that was just with Akka.Remote
Akka.Cluster wasn't available yet
frasermolyneux
@frasermolyneux
Jun 10 2016 20:05
Everything I have tried works great locally but becomes unstable in Azure - i'm thinking they simply do not mix well. We will see how easy deployment is to script without Azure
Aaron Stannard
@Aaronontheweb
Jun 10 2016 20:06
I've seen the same thing
runs great locally
works fine for about the first 10 minutes on Azure
when I deploy as a cloud service
and then I noticed that my worker roles start getting put to sleep
it's definitely an "Azure infrastructure works as advertised; not as expected" sort of scenario
frasermolyneux
@frasermolyneux
Jun 10 2016 20:07
I like how we can knock nodes offline to upgrade and have zero downtime with Akka - tried to do that on Azure and it forces all roles to restart
to11mtm
@to11mtm
Jun 10 2016 20:39

When developing a system with a 'ManagementService' System running on a Back-end server, and a WebAPI on a front end talking to the service via Remoting (Not clustering) The WebAPI's Actor System (Used for Entry point to talk to ManagementService) is defined separately from the ManagementService's Actor System.

Are there certain guidelines I should make sure to follow when shutting things down to minimize dissociation messages and failures?

ilhadad
@ilhadad
Jun 10 2016 21:28
@Horusiath I have placed all the code on my Git repo: here
The main program is EY.SSA.ActorSystemHost
ilhadad
@ilhadad
Jun 10 2016 21:33
It relies on the EY.SSA.CommonBusinessLogic. In this project you will find the code in question. The two files you need to look at are ClientSupervisor.cs and ClientListActor.cs. ClientSupervisor.cs sends the messages to the ClientListActor.cs on line 161
On the ClientListActor (which is a persistence actor) it handles the message on line 80. Notice how I have commented all to just leave a simple Command<object> to catch any messages. The interesting part is that as soon as I change the actor to a simple receive actor it receives the messages. There is definitely something going on here.
Any help figuring this out will be useful. Thanks so much.
frasermolyneux
@frasermolyneux
Jun 10 2016 21:44
@Aaronontheweb Using TopShelf has worked out great, only created a POC for now but I have a full pipeline with CI/CD using release management and PowerShell for the deployment. Surprisingly painless.
Aaron Stannard
@Aaronontheweb
Jun 10 2016 21:46
nice! for the PowerShell deployment, using any special Windows Server features to get your services up and running?
I had a talk with Jeff Snover last week and he dropped some knowledge bombs on me about some of the tools built into it that I didn't know about before
ok, this is freaking cool - the new IL view in ReSharper 16 basically showed me that I was able to remove a delegate allocation with a simple code change
frasermolyneux
@frasermolyneux
Jun 10 2016 21:48
Not in particular - just pre-deploy stopping+uninstalling services that are upgrading, then copying the artifacts to the server, then installing through Topshelf - then starting back up
Needs some elegance adding in but it works
Aaron Stannard
@Aaronontheweb
Jun 10 2016 21:51
nice
I'm looking forward to getting to do some more devops stuff with Akka.Cluster after we ship this thing
going to put together some tutorials around that
and hopefully some tools
frasermolyneux
@frasermolyneux
Jun 10 2016 21:52
Its been an interesting experience - not much information is currently out. I have wasted weeks on Azure :/
Aaron Stannard
@Aaronontheweb
Jun 10 2016 21:55
I feel your pain