These are chat archives for akkadotnet/akka.net

2nd
Sep 2016
Roger Johansson
@rogeralsing
Sep 02 2016 07:01
@Aaronontheweb regarding drone.io, it works. its an error in one of the pages:
Assembling web/docs/working-with-actors/creating-actors.html ERROR
Warning: Parse error on line 317:
...}    </body></html>
-------------------^
Expecting 'CONTENT', 'COMMENT', 'OPEN_BLOCK', 'OPEN_INVERSE', 'OPEN_ENDBLOCK', 'OPEN', 'OPEN_UNESCAPED', 'OPEN_PARTIAL', got 'EOF' Use --force to continue.
Ill try to see if I can make that report appear anywhere so it's easier to debug this thing
or if we can set up a shared droneio account to do the build so anyone of us can login and manage it
creating-actors.html is the failing page... and usually, there is some crap regarding having $ in the page.. IIRC
Maciek Misztal
@mmisztal1980
Sep 02 2016 09:32

Hey guys, On a servicediscovery node I have a /user/services/broadcast cluster-group router with broadcast strategy, which is configured in the following way:

akka {
actor {
provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
deployment {
/services/broadcast {
router = broadcast-group
routees.paths = ["/user/services"]
cluster {
enabled = on
allow-local-routees = off
use-role = servicediscovery
}
}
}
}
}
The curious thing is, that whenever I do a MyRouter.Ask<Routees>(new GetRoutees()).Result.Count(); I'm getting a single Member despite having 5 nodes which are up and running and clustered (received MemberUp) Is it something wrong with my configuration again? I was looking to replicate a mechanism from the WebCrawler sample.

Oh, and the Member is on a different node.
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 09:42
and @Aaronontheweb doesn't understand why I don't like routers ...
@mmisztal1980 are you sure that 'services' actor is started on each node?
Maciek Misztal
@mmisztal1980
Sep 02 2016 09:44
yes, I have 5 homogenous nodes which have the same startup and the /user/services actor is started on every one of them. I'm seeing indication of it's activity in the logs.
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 09:45
do they all have servicediscovery role?
Maciek Misztal
@mmisztal1980
Sep 02 2016 09:46

they all have the same configuration:

cluster {
seed-nodes = [
"akka.tcp://hive@127.0.0.1:50000"
]
roles = [servicediscovery]
}

Bartosz Sypytkowski
@Horusiath
Sep 02 2016 09:52
I'm too noob for cluster routers - but you may try something like:
routees.paths = [
    "/user/services"
    "/user/services"
    "/user/services"]
I'm curious if this will pass
Maciek Misztal
@mmisztal1980
Sep 02 2016 09:54
I'll give it a shot in 60'ish minutes and let you know - in a meeting right now
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 09:54
sure
Kris Schepers
@schepersk
Sep 02 2016 11:13
@Horusiath @Aaronontheweb We might have located the problem.. There is this event projection actor which subscribes to the akka event stream for the LBVIngeschreven event. When handling the message, a message is sent over a cluster router to another node in the cluster to retrieve some info: ResponseMsg = ClusterRouterActor.Ask(RequestMsgType).Result. And it seems that once there's a hickup in the cluster and the response gets lost, this code just hangs en the actor is basically frozen (perfectly explainable).
So basically, if this is the case, there is no problem in Akka whatsoever :-)
Arjen Smits
@Danthar
Sep 02 2016 11:14
Ask has by default an infinite timeout.
Kris Schepers
@schepersk
Sep 02 2016 11:14
We're rewriting this to an Ask().PipeTo(Self) flow
Arjen Smits
@Danthar
Sep 02 2016 11:14
You can override this in the config
Kris Schepers
@schepersk
Sep 02 2016 11:15
@Danthar Yes, I know, but it's the .Result part which blocks everything here..
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 11:15
@schepersk what @Danthar said + Ask(Request).PipeTo(Self) is a more expensive equivalent of Tell(Request) ;)
Arjen Smits
@Danthar
Sep 02 2016 11:16
Wont Ask().PipeTo() still suffer from the same problem if the timeout is infinite ?
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 11:16
only difference is the timeout failure, but you can solve this by applying Context.SetReceiveTimeout(timeout)
DmitriySelischev
@DmitriySelischev
Sep 02 2016 11:18
Hello, guys! Yesterday i wanted to update akka from 1.0.6 to latest 1.1.1. All went smoothly except a one thing. PostgreSql plugin for akka.persistence is on a version for akka 1.0.5 and is not compatible with a new akka.persistence version. I decided to stay persistence plugin on a old version and cluster is works right except unit tests. Can you tell me a status of postgresql plugin? Or maybe we should switch to an else concrete plugin?
Arjen Smits
@Danthar
Sep 02 2016 11:18
@Horusiath won't that only solve the unresponsiveness problem? What happens with the Ask pipeline if it never returns due to an infinite timeout ?
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 11:19
@DmitriySelischev can you describe your issue in akka postgres plugin github repo? Maybe that was bug during deployment.
Kris Schepers
@schepersk
Sep 02 2016 11:19
@Horusiath Do PipeTo(Self) messages have higher priority in the mailbox queue?
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 11:20
@schepersk unless you've configured priority mailbox for an actor, all messages have the same priority
DmitriySelischev
@DmitriySelischev
Sep 02 2016 11:21
@Horusiath at the NuGet has no any another versions of PostgreSql plugin greater then for akka 1.0.5
Kris Schepers
@schepersk
Sep 02 2016 11:21
The reason we're using Ask here is that we would like to wait for the response before continuing with the next message in the mailbox
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 11:22
@schepersk use ReceiveAsync then
DmitriySelischev
@DmitriySelischev
Sep 02 2016 11:22
@Horusiath I found latest version on github in one of forks but we decided that it does not ready, so, we don't use it
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 11:23
@DmitriySelischev postgres was a little delayed, as they were not a lot people interested in using it
I guess we'll release it soon - after the next akka core release
we're going to fix one bug with persistence queries there and introduce support for jsonb datatype
DmitriySelischev
@DmitriySelischev
Sep 02 2016 11:24
@Horusiath ok, thank you! it will be great!
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 11:25
@Danthar if Ask will never return, then we're fucked :D
Maciek Misztal
@mmisztal1980
Sep 02 2016 11:26
lol true story
Kris Schepers
@schepersk
Sep 02 2016 11:29
@Horusiath Hmm, does ReceiveAsync basically creates a separate mailbox? Or how should I visualize this?
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 11:30
@schepersk no, ReceiveAsync suspends current mailbox until asynchronous lambda inside of it finishes.
I've written a blog post which describes how Ask works and why it's bad
but in your case there are two options
Maciek Misztal
@mmisztal1980
Sep 02 2016 11:32
does anyon have an example on working with a local consistent-hashing-group router? I'd like to know how to add a new routee in code, to an existing router?
(on a single node)
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 11:34
@schepersk
  • Officially advised - using Become + stashing. So when you'll need to wait for a particular message, you change actor's behavior which will react on that message and stash any other. Once a message will be received, unstash all stashed messages so far. Takes more time to write, but it's faster.
  • Officially avoided - using ReceiveAsync + Ask. So simply call other actor using Ask and define whole actor behavior as asynchronous. Easy to write, but it's slower and allocates more.
@mmisztal1980 in general adding nodes to consistent-hash router is bad idea
with bigger number of nodes, the hash ranges - each actor is responsible for - will change, so the same message may be forwarder to different actor after resizing the router
Arjen Smits
@Danthar
Sep 02 2016 11:37
@Horusiath i forgot you did that blog post about ask. That aggregator pattern is awesome in its simplicity
Maciek Misztal
@mmisztal1980
Sep 02 2016 11:38
I have a valid reason to do it, but I can't find accurate information on how to do it - probably missed it somewhere, the docs don't specify it - can you point me to it?
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 11:40
@mmisztal1980 it's not in the docs, but routers have defined some special messages (just like GetRoutees) - AddRoutee is one of them.
Maciek Misztal
@mmisztal1980
Sep 02 2016 11:41
so ActorOf is not the way to go here?
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 11:42
ActorOf is used to create an actor you want to add as a routee
Maciek Misztal
@mmisztal1980
Sep 02 2016 11:43
so if I have /user/myrouter , can I use ActorOf<TActor>("/user/myrouter/{id}");
?
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 11:43
no you cannot
Maciek Misztal
@mmisztal1980
Sep 02 2016 11:44
I see. Is there an example on GitHub that you're aware of?
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 12:05
to add any IActoRef to the router ref use routerRef.Tell(new AddRoutee(new ActorRefRoutee(actorRef))). You can add actor selections too that way - just change ActorRefRouteeActorSelectionRoutee
sorry, but my Internet connection is messing up with me
Carey Free
@Cawifre
Sep 02 2016 12:37
In the case of using both Akka.DI.Autofac and Akka.Remote, is it expected for the AutofacDependencyResolver to serialized when creating an actor deployed to a remote scope?
Kris Schepers
@schepersk
Sep 02 2016 12:56
@Horusiath I get the Become + Stashing part.. But in practice, this could mean stashing and unstashing 1000+ messages over and over again to process them one by one..
Arjen Smits
@Danthar
Sep 02 2016 13:01
DI does not work accros process boundaries
so it only works for the local actor system
Carey Free
@Cawifre
Sep 02 2016 13:24
@Danthar That makes sense, but I would have expected failure in that situation to manifest as "you just called Context.DI() but the container is over on that other system" instead of "you just called Context.ActorOf() so I'm gonna try to serialize this DI container"
Unless there is some context where it would ever be possible to send a DI container over the wire (which reliance on lamdas et al pretty much prohibits) it seems a very silly thing to do
Maciek Misztal
@mmisztal1980
Sep 02 2016 13:46
@Horusiath when configuring the consistent-hashing-group router for the usage we've discussed - do I need to configure routee(s) paths?
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:12
@mmisztal1980 only if you need some routees to start with
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:14
no :) I don't - tryuing to do a router.Tell(new AddRoutee(new ActorRefRoutee(Sys.ActorOf<PingPongActor>()))); but I have no idea how to pass the ID, should it be the id alone or the full path? /myrouter/id ?
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:39
actor paths always refer to parent-child hierarchy, they are not associated with routers
if you have /myrouter/id this means that actor with name id is a child of actor with name myrouter
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:39
so I should pass the full path - correct?
Kris Schepers
@schepersk
Sep 02 2016 14:40
@Horusiath I get the Become + Stashing part.. But in practice, this could mean stashing and unstashing 1000+ messages over and over again to process them one by one..
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:40
if you have pool routers then routees are children of the router
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:41
I'm dealing with a group router
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:41
@schepersk if you have 1000+ messages regularly awaiting in actor's mailbox, then you have some serious performance/scalability issues ;)
@mmisztal1980 if you're sending selection routee, then it must be full path
Kris Schepers
@schepersk
Sep 02 2016 14:42
yes, but besides that? (I just want to completely understand these things)
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:42
it will be easier to talk with some code in front
@schepersk yes, this could be the case - however moving messages to/from mailbox is fairly lightweight process
to be sure, you'd need to benchmark both solutions for your case
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:44
having problems with adding that actor by actor ref...
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:45
@mmisztal1980 any errors?
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:45
Result Message: Illegal actor name [statuses/932bc80f-c7d1-47ab-bd01-c16c204c4799]. Actor paths MUST: not start with $, include only ASCII letters and can only contain these special characters: $"-_.*$+:@&=,!~';"().
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:46
$ is reserved for akka auto-generated names
Kris Schepers
@schepersk
Sep 02 2016 14:46
@Horusiath owkay, thanks!
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:46
here's the test I'm trying to get to work:
 public class ConsistentHashRouterTests : TestKit
    {
        public const string RouterName = "statuses";

        public const string AkkaConfig = @"
        akka {
            actor {
                deployment {
                    /statuses {
                        router = consistent-hashing-group
                    }
                }
            }
        }";

        public class PingPongActor : ReceiveActor
        {
            public PingPongActor()
            {
                Receive<string>((msg) =>
                {
                    if (msg.Equals("ping")) Sender.Tell("pong");
                });
            }
        }

        public ConsistentHashRouterTests()
            : base(AkkaConfig)
        {
        }

        [Fact]
        public void X()
        {
            // Arrange
            var id = Guid.NewGuid().ToString();
            var router = Sys.ActorOf(Props.Empty.WithRouter(FromConfig.Instance), RouterName);
            var actorPath = $"/{RouterName}/{id}";

            // Act
            router.Tell(new AddRoutee(new ActorRefRoutee(Sys.ActorOf<PingPongActor>(actorPath))));

            Sys.ActorSelection(actorPath).Tell("ping");

            // Assert
            ExpectMsg("pong");
        }
    }
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:47
you cannot build actor name this way $"/{RouterName}/{id}"
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:47
ok, suggestions?
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:48
regarding the name? does it even matter? :P
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:49
I have no idea how to fix this right now :/
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:49
if you need to identify it use some prefix suffix like $"routee-{id}"
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:51
what about the router name?
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:51
Sys.ActorOf<PingPongActor>(id) will create an actor under /user/{id} path - for the router it doesn't matter where the actor is placed.
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:52
ahhh
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:52
why do you need a router name for when creating an actor?
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:52
never done it so I was wondering how it's done
Modified it a little, still fails
  [Fact]
        public void X()
        {
            // Arrange
            var id = Guid.NewGuid().ToString();
            var router = Sys.ActorOf(Props.Empty.WithRouter(FromConfig.Instance), RouterName);
            var actorPath = $"status-routee-{id}";
            var routedPath = $"/{RouterName}/{actorPath}";

            // Act
            router.Tell(new AddRoutee(new ActorRefRoutee(Sys.ActorOf<PingPongActor>(actorPath))));

            Sys.ActorSelection(routedPath).Tell("ping");

            // Assert
            ExpectMsg("pong");
        }
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:54
adding routees to router work on any actor, there are no direct requirements if I remember correctly.
when you're creating actor using directly Sys.ActorOf, it will be located under user root actor guardian, not router.
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:56
ok, what's the correct way to do it here then? I can't do a router.ActorOf<T>() I think...
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:56
so when you're using ActorSelection, don't provide it a routedPath - this actor doesn't live as router's child
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:57
ok, but I what if I want to reference it like : /user/statuses/{id} using the hash router?
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 14:57
if you really need an actor to be child of router, you need to use pool-router
I think, you're messing consistent hashing routers with cluster sharding here ;)
Maciek Misztal
@mmisztal1980
Sep 02 2016 14:59
think I need to read up on something here...
Valeriy Reutskiy
@vvreutskiy
Sep 02 2016 15:02
I have an issue running Akka.MultiNodeTestRunner.exe:
When I run it with my assembly ( https://gist.github.com/vvreutskiy/2d91e4003d256e6f1708dd7065b33b12 ) like this:
Akka.MultiNodeTestRunner.exe C:\src\akka.net\src\Experiment\Akka.Experiment\bin\Debug\Akka.Experiment.dll -Dmultinode.spec="ExperimentClusterSpecs"
Or even like this:
Akka.MultiNodeTestRunner.exe C:\src\akka.net\src\Experiment\Akka.Experiment\bin\Debug\Akka.Experiment.dll
I am not getting any log messages from my test, neither logged by "this.Log()" nor logged by "Console.WriteLine()"
I think my test was not executed at all, because Debugger.Launch() is not triggered, however 3 nodes were started, as I see in log: https://gist.github.com/vvreutskiy/1d7416ed001b67948f87bfe80ded6758
Sergey Prytkov
@Rattenkrieg
Sep 02 2016 15:27
Hi guys, can someone explain me how cluster singleton manager is capable of deploying its underlying actor to lighthouse node if lighthouse does not contain any bussiness assemblies?
Valeriy Reutskiy
@vvreutskiy
Sep 02 2016 15:43
@Rattenkrieg it is not capable, you will get 'TypeLoadException: Could not load type...'. Lighthouse used only for discovery purposes. However, if you compile lighthouse with your business assembly, underlying actor can be deployed to it.
Chris G. Stevens
@cgstevens
Sep 02 2016 15:43
yep.. make sure you are sharing your shared assembly :)
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 15:53
@Rattenkrieg lighthouse is basically a stub of cluster-aware actor system. So for other nodes it looks like an ordinary node. They don't know if it's able to handle singletons or not, and if you won't precise that by using cluster roles, they will assume it's possible to establish singleton on lighthouse node.
Sergey Prytkov
@Rattenkrieg
Sep 02 2016 16:29
Thank you all guys, thats exactly what I was assuming. But decided to consult with humans since Erlang is capable of remote deploying and somewhere in Akka documentation were briefly mentioned about similar features.
Aaron Stannard
@Aaronontheweb
Sep 02 2016 17:16
oh god
I started requiring GPG verification on all of my commits when I rebuilt my development machine on Monday
had to perform a big rebase on the mono-certification branch and had to sign like 60 of them that I hadn't signed previously
Aaron Stannard
@Aaronontheweb
Sep 02 2016 17:28
definitely at the bleeding edge of DevOps here
trying to get Akka.Persistence CI up and running again while I wait for a mono build report
forking that one I guess
"hey I know what we can do to solve this horrible DevOps problem we have supporting all of these databases! Let's use Docker!"
This message was deleted
Aaron Stannard
@Aaronontheweb
Sep 02 2016 17:33
it's working great for some of the simple stuff, like Mono builds
but as soon as I need two docker containers to play nice with each other, that's been a bit of a bear due to NAT issues and Windows Server 2016 being immature
one thing that's kind of funny
when you start looking for Docker + Windows stuff online
you get all of these hype articles from ScottGu, Jason Zander et al
and they were all written in 2014
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 17:38
this gif sums up my experience of trying common oss concepts in .net environment
;)
Aaron Stannard
@Aaronontheweb
Sep 02 2016 17:38
lol
I have no trouble with the normal .NET environments
it's when my .NET environment wants me to invite this weird teenager named MongoDb into my house
Bartosz Sypytkowski
@Horusiath
Sep 02 2016 17:39
I had, when we were evaluating tech stack for our microservice-based thing in my work, we ended build half of it ourselves, as they were no non-proprietary equivalents in .net space
Aaron Stannard
@Aaronontheweb
Sep 02 2016 17:39
and if I don't keep an eye on it, it empties out my liquor cabinets and takes joyrides in the camero when I'm not looking
oh I see
I know what you mean now
yeah Windows is the platform that missed out on a decade of DevOps innovation
playing catchup big time now
Windows Server 2016 was originally supposed to be 2015
looks like it's going to end up being 2017 if we're lucky
damn
the Mono compilation process
is really damn fast
on our build agents
Aaron Stannard
@Aaronontheweb
Sep 02 2016 17:48
heyo
found a deadlock
and old one that's been around for a long time by the looks of it
Vagif Abilov
@object
Sep 02 2016 17:48
I suddenly got an error "System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted". I was running several processes creating actor systems with the same name. Could this be the cause of the error?
Aaron Stannard
@Aaronontheweb
Sep 02 2016 17:49
@object on Mono?
or what error
Vagif Abilov
@object
Sep 02 2016 17:49
No on Windows
Aaron Stannard
@Aaronontheweb
Sep 02 2016 17:49
it sounds like something didn't close its socket
when it was terminated
or two processes started with the same binding information
Vagif Abilov
@object
Sep 02 2016 17:50
What I did I configured two Windows services based on the same application. As long as I start the second one I am getting this error.
Aaron Stannard
@Aaronontheweb
Sep 02 2016 17:50
are they each using different ports?
Vagif Abilov
@object
Sep 02 2016 17:50
Basically it's two instances of the same process configured using different service instance names.
Aaron Stannard
@Aaronontheweb
Sep 02 2016 17:51
regarding the deadlock
private void AddLogger(ActorSystemImpl system, Type loggerType, LogLevel logLevel, string loggingBusName, TimeSpan timeout)
        {
            var loggerName = CreateLoggerName(loggerType);
            var logger = system.SystemActorOf(Props.Create(loggerType).WithDispatcher(system.Settings.LoggersDispatcher), loggerName);
            var askTask = logger.Ask(new InitializeLogger(this));

            if (!askTask.Wait(timeout))
            {
                Publish(new Warning(loggingBusName, GetType(),
                    string.Format("Logger {0} [{2}] did not respond within {1} to InitializeLogger(bus)", loggerName, timeout, loggerType.FullName)));
            }
            else
            {
                var response = askTask.Result;
                if (!(response is LoggerInitialized))
                {
                    throw new LoggerInitializationException($"Logger {loggerName} [{loggerType.FullName}] did not respond with LoggerInitialized, sent instead {response}");
                }

                _loggers.Add(logger);
                SubscribeLogLevelAndAbove(logLevel, logger);
                Publish(new Debug(loggingBusName, GetType(), string.Format("Logger {0} [{1}] started", loggerName, loggerType.Name)));
            }
        }
Vagif Abilov
@object
Sep 02 2016 17:51
I guess there might a conflict with ports, I wonder if it can be caused by actor system.
Aaron Stannard
@Aaronontheweb
Sep 02 2016 17:52
!askTask.Wait(timeout) - if we're running on a single core without hyper-threading (i.e. in a Docker container)
this will be a fun race condition that can result in a deadlock
right way to solve this is to apply that timeout to the Ask and use a continuation to complete the rest (although that might mean having to synchronize _loggers)
@object the actor system name is unkown to the socket
so that won't cause a conflict
Vagif Abilov
@object
Sep 02 2016 17:53
This is what I thought.
Aaron Stannard
@Aaronontheweb
Sep 02 2016 17:53
it's just the protocol (tcp vs udp), the address, and the port
that could cause the socket to throw that exception
this is usually a port conflict that causes this
Vagif Abilov
@object
Sep 02 2016 17:54
I see. Need to dig deeper then.
Aaron Stannard
@Aaronontheweb
Sep 02 2016 18:01
ah nope, not a deadlock
well, kind of
but not handling it correctly
Aaron Stannard
@Aaronontheweb
Sep 02 2016 19:32
on Mono
looks like a couple of tests are throwing exceptions on purpose... and XUnit is still failing them for some reason
Aaron Stannard
@Aaronontheweb
Sep 02 2016 19:50
System.SystemException : Thread creation failed.
  at System.Threading.Thread.StartInternal (IPrincipal principal, System.Threading.StackCrawlMark& stackMark) <0x411f1470 + 0x000e7> in <filename unknown>:0 
  at System.Threading.Thread.Start (System.Threading.StackCrawlMark& stackMark) <0x411f1320 + 0x000c4> in <filename unknown>:0 
  at System.Threading.Thread.Start () <0x412bb920 + 0x0002b> in <filename unknown>:0 
  at Akka.Actor.DedicatedThreadScheduler..ctor (Akka.Actor.ActorSystem system) <0x412bb410 + 0x002e3> in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) <0x411618d0 + 0x00045> in <filename unknown>:0
Marc Piechura
@marcpiechura
Sep 02 2016 19:50
:+1: but don't worry I'm currently adding more :P
Aaron Stannard
@Aaronontheweb
Sep 02 2016 19:51
welp, I know exactly what the issue is here
the guilty party is named right there in the exception
DedicatedThreadScheduler is being leaked across multiple unit tests
because I don't think we dispose of it properly...
in a test suite as large as Akka.Streams
that can become an issue
looks like Mono / Linux might be more sensitive to that than Windows
I think we have an open issue for this
akkadotnet/akka.net#1593 - its performance
but I thought we had an issue about guaranteeing clean shutdowns
Marc Piechura
@marcpiechura
Sep 02 2016 19:55
I only remember the issue with running the complete test suite inside VS where we saw these strange issues while it's working on the build server
Aaron Stannard
@Aaronontheweb
Sep 02 2016 19:56
this might be a source of heisenbugs on the build server to some extent too if it doesn't shut down properly
Marc Piechura
@marcpiechura
Sep 02 2016 19:56
but I don't think we created an official issue for it
Aaron Stannard
@Aaronontheweb
Sep 02 2016 19:56
you end up with all of these rogue threads that are doing work the longer an individual test suite runs
won't affect the MNTR
but it would affect the normal XUnit suites
I'll open an issue and start working on this right away
might be a good opportunity for me to implement the hashed wheel scheduler while I'm at it
depending on how much work that will take
Marc Piechura
@marcpiechura
Sep 02 2016 19:58
@Horusiath did some research a while ago but can't remember what exactly he found out
Aaron Stannard
@Aaronontheweb
Sep 02 2016 20:07
on the bright side
almost have the Postgres integration testing stuff working locally
need to make some tweaks to our FAKE script for that plugin so that we can compile on Mono
probably going to need to spend a day with my Ubuntu laptop to go through a bunch of those and make it work
docker run --name akka-postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=akka_persistence_tests -d postgres

docker run -ti --rm --name akka-pg-mono --link akka-postgres:postgres akkadotnet/mono-base
that'll get the two docker containers into an environment where they can see each other
just need to run our build process inside the mono one and adjust the app.config to use the domain "postgres" as its hostname
cool part about it is that I can run this setup for several different versions of Postgres at once
just need to change the version tag at the very end of the command
I'm headed to Vegas for the 3-day weekend here in the USA otherwise I'd try to get that up and running this weekend
but it's reaaaaaaaaaally close now - was able to connect to the Postgres box via pgsql and verify that our default database et al are there
as for the scheduler
Aaron Stannard
@Aaronontheweb
Sep 02 2016 20:13
akkadotnet/akka.net#2288
going to verify it with a spec and work backwards from there
we had to do this for dispatchers as part of 1.1 also
the "deregistration" logic took care of it and was validated via the Akka.Tests.Dispatch.ActorModelSpec
Aaron Stannard
@Aaronontheweb
Sep 02 2016 20:21
yeah, the DedicatedThreadScheduler definitely leaks
there isn't even any code to shut it down
Joe Wirtley
@JoeWirtley
Sep 02 2016 20:21
In a supervisor strategy, is there a way to identify the actor that failed?
Aaron Stannard
@Aaronontheweb
Sep 02 2016 20:23
@JoeWirtley I can't recall offhand
might be something on the ActorContext but I don't think so
huh... that's a good question... why don't we include that? guess the idea is that if the actor is suspended (which it is) and it can't receive any messages until you send it a supervision directive, what's the point of getting an actorreference back to it? Then again I guess there's an argument to be made for being able to treat specific children differently than others if their capabilities are well-known
Sergey Prytkov
@Rattenkrieg
Sep 02 2016 20:27
@JoeWirtley shouldn't it be in Sender property?
Aaron Stannard
@Aaronontheweb
Sep 02 2016 20:27
that being said: glue-gunning if statements in a supervision strategy together to filter on the actor by it's name automatically creates tight coupling now
if you want to send a signal that this actor needs special treatment, you're better off catching the exception and wrapping it into an outer exception and throwing that
filter by what was thrown
not by who threw it
(sorry for the stream of consciousness there)
Joe Wirtley
@JoeWirtley
Sep 02 2016 20:30
@Rattenkrieg Wondered that also, haven't tried it yet.
@Aaronontheweb Thanks for the thoughts. I think I may have cases where I have heterogeneous children and if any kind of failure occurs in a certain kind of child, I may want to handle that in a unique way.
Aaron Stannard
@Aaronontheweb
Sep 02 2016 20:37
create a custom exception type and wrap it
Joe Wirtley
@JoeWirtley
Sep 02 2016 20:44
@Aaronontheweb Is there an easy way I can catch every exception thrown by an actor? (newb, so not sure if I'm missing something)
Aaron Stannard
@Aaronontheweb
Sep 02 2016 20:44
in an UntypedActor it's pretty easy - just need a general Catch(Exception ex) block inside your OnReceive method
with a ReceiveActor you'll need to do that for each Receive<T>
or you can override AroundReceive
and put the try..catch block there
which will catch all of them
Aaron Stannard
@Aaronontheweb
Sep 02 2016 20:47
oh snap
you're right
the Sender field does catch it
cc @JoeWirtley
Sergey Prytkov
@Rattenkrieg
Sep 02 2016 20:48
was too lazy to bootstrap demo, dig it in sources =D
Joe Wirtley
@JoeWirtley
Sep 02 2016 20:48
@Rattenkrieg @Aaronontheweb Thanks!
Aaron Stannard
@Aaronontheweb
Sep 02 2016 20:49
looks like the DedicatedThreadScheduler exits the thread when the actor system is terminated according to this code
but that's specific to that implementation - there's no deterministic way of shutting down a scheduler for sure, in other words
a PSA for anyone who works on projects whose code I and other like-minded developers might have to read one day: friends don't let friends write partial classes
Aaron Stannard
@Aaronontheweb
Sep 02 2016 20:57
these things are a killer for readability
Sergey Prytkov
@Rattenkrieg
Sep 02 2016 20:58
@Aaronontheweb may be converting underlying thread in DedicatedThreadScheduler to Foreground one should help?
Jeff
@jpierson
Sep 02 2016 20:59
Is there an abstraction or technique for better doing at-least-once guarantees between remote actors? The current AtLeastOnceDeliveryActor requires persistence and inhertance to accomplish this and I'm looking for more of something that just does a similar ack, retry pattern without the dependency on Akka.Persistence. I've seen reference to Reliable Proxy pattern and I've implement something along those lines myself for our cluster (OrderedRetryActor) but I feel like I've probably reinvented some version of the wheel as I'm debugging an issue in my custom implementation.
Jon Nyman
@jon49
Sep 02 2016 22:49

This is really early stages for me. But I just wanted to do some fact finding first. The app that I'm programming already exists, but we might be taking it in a different direction. It is basically a "choose your own adventure" kind of application. So, the data set if pretty fixed - although updates are done all the time to the data set. The data set is parsed into a more friendly consumable set and put in other databases.

So, I was thinking this would be a perfect app for Elixir since it has a built in database so I could use the native objects and do any extra filtering for individual calls. I like the idea of hot loading and knowing that it is robust. I'm also, big into function, F# being my favorite language having left a whole heap of it at the previous company I was working for.

But then I was listening to dot net rocks and I was thinking maybe akka.net would work and then I could continue to work with F# and have static typing. Would akka.net be a good fit for this?

Also, we would prefer to move to linux for budgetary concerns. With .NET Core, it should be pretty speedy too. When will akka.net work with .NET core? Do I really need to use ASP.NET or does akka.net have a lighter implementation for web api that I could use?

Sorry for the long ramble! Thanks ahead of time for anyone that answers!

Aaron Stannard
@Aaronontheweb
Sep 02 2016 22:55
@jon49 .NET Core work is in progress
and we're going to be certified, with benchmarks, on Mono pretty soon
so you'll have a Linux story with either one of those
Mono is a much lower bar to clear than .NET Core is
Jon Nyman
@jon49
Sep 02 2016 22:56
Mono would be fine, I just thought mono was slower. But we don't need blazing fast.
Aaron Stannard
@Aaronontheweb
Sep 02 2016 22:57
honestly I've been a bit surprised by the Mono benchmarks I've run for Helios, the transport system
Jon Nyman
@jon49
Sep 02 2016 22:57
I was reading about Hopac and how it was pretty fast on windows but the linux port was considerable less performant
Cool.
Aaron Stannard
@Aaronontheweb
Sep 02 2016 22:57
Mono, running inside a Docker container, can actually outperform the Windows one in some cases
although generally the Windows one is slightly faster
all of the work that's gone into Mono 4.x since the CLR was open sourced really shows
Jon Nyman
@jon49
Sep 02 2016 22:58
So, do you think this would be a good use case for akka.net?
Aaron Stannard
@Aaronontheweb
Sep 02 2016 22:58
hot code loading is something that Akka.NET does not natively support
honestly that's a big CLR issue with the way AppDomains and unloading DLLs is done
Elixir / Erlang has a more elegant way of handling that
but I digress
I recommend going through Akka.NET Bootcamp if you want to get a feel for it
I'm not much of an F# user, so better to ask folks like @Horusiath about that
Jon Nyman
@jon49
Sep 02 2016 23:01
So, does akka.net have a lighter weight web api library?
Aaron Stannard
@Aaronontheweb
Sep 02 2016 23:01
Akka.HTTP? no - not yet and not for some time
Jon Nyman
@jon49
Sep 02 2016 23:01
So, I wouldn't need to use ASP.NET on top of it?
Aaron Stannard
@Aaronontheweb
Sep 02 2016 23:01
you'd need to use ASP.NET or Nancy on top of it today
Jon Nyman
@jon49
Sep 02 2016 23:02
OK. It seems like it would make for a blazing fast app with a lib built specifically for akka.net. Is that correct, or just wishful think?
Aaron Stannard
@Aaronontheweb
Sep 02 2016 23:02
yep, you can get some pretty awesome performance with Akka.NET
I'm going to be using a design similar to that in a new project
Jon Nyman
@jon49
Sep 02 2016 23:03
Cool. Well, it will be exciting when someone does that. Wish I had the time for it myself! Not sure how all you guys do it.
Aaron Stannard
@Aaronontheweb
Sep 02 2016 23:03
and I've done it in the past
Jon Nyman
@jon49
Sep 02 2016 23:03
With in memory data?
Aaron Stannard
@Aaronontheweb
Sep 02 2016 23:03
yep
Jon Nyman
@jon49
Sep 02 2016 23:04
Nice. I'm assuming that will be in the bootcamp.
Aaron Stannard
@Aaronontheweb
Sep 02 2016 23:04
and I started writing about the new one I'm working on here: https://petabridge.com/blog/akkadotnet-application-design-part1/
Jon Nyman
@jon49
Sep 02 2016 23:05
Cool. Thanks for your help. I'll start taking the deep dive.