These are chat archives for akkadotnet/akka.net

8th
Apr 2016
Vagif Abilov
@object
Apr 08 2016 06:06
Good morning, I am trying to build Akka.Net from sources (master branch), but Akka.Cluster.TestKit doesn't compile with plenty of errors (missing ImmutableHashSet etc.).
And 16 of 172 tests in Akka.Persistence.Tests failed. Do they need some machine-specific prerequisite?
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 06:51
@object In general our main working branch is dev. It looks like your nuget restore may have failed. Also about tests - if your using R# with xunit test runner, those tests have tendency to fail randomly.
... which is another issue @Aaronontheweb - I don't know how to achieve this, but we cannot afford random false flags in tests. This problem will be even bigger when we'll introduce akka streams, as we'll have 800 additional cases, that also have tendency to give us false negatives.
using xunit with parallel mode off? Maybe switching to NUnit could help?
Alex Valuyskiy
@alexvaluyskiy
Apr 08 2016 07:18
@Aaronontheweb I've updated SqlServer and PostgreSql implementations to Akka 1.0.7, and have made a pull request to MySql repo.
But I have failed unit tests in PostgreSql, when I update to Npgsql 3.0.5 (but all works fine with Npgsql 2.x). I need help with that
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 07:19
@alexvaluyskiy any error message or stack trace?
Zetanova
@Zetanova
Apr 08 2016 07:22
@Horusiath I think i just fixed my problem, the AR is pushing an EntityRequested event after initializion into the EventBus. The projector is reacting to it, and sends the new entity to the Sender of the create command.
So the Import Process sends the create command and waits until it gets all created entities back.
Of course its not fixing a parallel processing, but since the two importers run in sequence its good for me
Alex Valuyskiy
@alexvaluyskiy
Apr 08 2016 07:30
@Horusiath no error messages, just reading events in a inappropriate order
Vagif Abilov
@object
Apr 08 2016 08:27
My yesterday's issue with Akka always choosing JSON.NET as serializer is resolved. As it often occurs, there was a problem with my config file.
Kris Schepers
@schepersk
Apr 08 2016 09:30
Hmm, after updating the nuget packages, unit tests testing persistent actors are all failing.. Messages don't arrive.. Any idea's anyone?
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 09:30
@schepersk are you using default journal?
Kris Schepers
@schepersk
Apr 08 2016 09:31
not using any journal in unit tests..
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 09:31
so how are you testing persistent actors?
Kris Schepers
@schepersk
Apr 08 2016 09:32
like any other actor basically.. if I need some state from previous commands, those commands are also being sent
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 09:33
probably your problem is related to akkadotnet/akka.net#1861
Kris Schepers
@schepersk
Apr 08 2016 09:34
I'll check it out!
Kris Schepers
@schepersk
Apr 08 2016 09:40
Yep, that is the problem indeed!
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 09:40
the fix is on the way, we missed that regression
Kris Schepers
@schepersk
Apr 08 2016 09:41
Applying that setting in the test class configuration did the trick
Carlos Torrecillas
@CarlosTorrecillas
Apr 08 2016 10:12
hi guys, I spoke to @Aaronontheweb and suggested me to get in touch with @Danthar to configure the CI/NuGet package for this: https://github.com/akkadotnet/Akka.DI.SimpleInjector
anybody that could help?
Arjen Smits
@Danthar
Apr 08 2016 10:17
Yes
Created an issue on the repo to help track it.
Basically what needs to be done is adding the proper build infrastructure. So we can setup our CI around it
Carlos Torrecillas
@CarlosTorrecillas
Apr 08 2016 10:22
ok
is there anything I could do?
Arjen Smits
@Danthar
Apr 08 2016 10:24
Yup. setup the build.fsx and stuff. Look at the Logging repos for an example
Carlos Torrecillas
@CarlosTorrecillas
Apr 08 2016 10:24
perfect, will do that
Arjen Smits
@Danthar
Apr 08 2016 10:24
only difference is that this one also needs to support running the tests and stuff
You can look at the SqlServer repo on how you can integrate calling the tests in your fake script and build.cmd. It contains alot more then your gonna need.
But its good enough to get you started.
Zetanova
@Zetanova
Apr 08 2016 10:54
Is there a easy why to count the messages that survivied a Gen0 GC ?
Kris Schepers
@schepersk
Apr 08 2016 13:31
Is it possible to configure a serializer only for persistence? So for example, the default serializer is used by akka for everything where needed, but when it's time to persist a message, another serializer is used..
For the moment we're using a custom serializer for our events that get persisted in the journal. For everything else, the default serialization is used.
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 14:44
@schepersk serializers are assigned by interface/class and are inheritance aware
so you can have marker interface for your persistent events, and bind it with serializer of your choice
Weston
@ronnyek
Apr 08 2016 14:53
anyone know if lighthouse is becoming a bit more solid in regards to how to have lighthouse nodes drop out and re-connect without having to restart bits of system?
seem to recall lighthouse wasnt too robust as far as fascilitationg initial discovery and then letting nodes gossip etc
Aaron Stannard
@Aaronontheweb
Apr 08 2016 15:22
@ronnyek that has everything to do with Akka.Cluster
and yes - we're furiously working on that
@Horusiath I agree with that - once Streams is ported the focus needs to shift on hardening specs across the board
and rooting out any obvious design flaws in the testing infrastructure, the code, and the tests themselves
Weston
@ronnyek
Apr 08 2016 15:40
I like furiously
and I wasnt trying to insult anyone
Aaron Stannard
@Aaronontheweb
Apr 08 2016 15:41
no offense taken
it's like the most commonly reported, and unfortunately complicated, set of bugs that we hear about
Weston
@ronnyek
Apr 08 2016 15:41
I do still intend on contributing some pretty serious chunks of work to the community built on akka.net
Aaron Stannard
@Aaronontheweb
Apr 08 2016 15:42
no worries man, you're good
Kris Schepers
@schepersk
Apr 08 2016 16:56
@Horusiath I see, then we're doing it right. We indeed have a marker interface for the persisted events which is bound to the custom serializer. Does that mean that Akka uses this serializer also for sending those messages over the event bus?
Vlad Kosarev
@vladkosarev
Apr 08 2016 18:24
Is this the right way of executing async inside F# actors? I am having trouble with concurrency it seems.
async {                         
                        let! result = brain() |> Async.Catch
                        match result with
                        | Choice1Of2 _ -> return Success
                        | Choice2Of2 exn -> return Failure
                    }
                    |!> parent.Self
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 18:34
@schepersk yes - a little note here: it's up to persistence provider to determine the format, message is serialized to i.e. sql-based plugins use akka serialization mechanism, while others like mongodb, have their own serialization, compatible with underlying provider
@vladkosarev yes, it seems so
Vlad Kosarev
@vladkosarev
Apr 08 2016 18:37
@Horusiath hrm, ok, thanks. It looks like I don't have much parallelism if that async call has any web calls, trying to figure out if the problem is in my use of akka or web library
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 18:38
what do you mean?
Vlad Kosarev
@vladkosarev
Apr 08 2016 18:40
@Horusiath that brain() function there is an async request/response to an api and if I spin up a 100 of those actors it looks like it takes a while for all of the requests to come back even though the server should return almost instantly (304s)
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 18:41
are you sure you're balancing the request to them? Also if you can, maybe you could gist the example?
Vlad Kosarev
@vladkosarev
Apr 08 2016 18:45
this is pretty much the extent of that brain() function -
let get url expectedCode = 
  async { 
    let! response = createRequest Get url |> getResponse
    match response.StatusCode with
    | code when code = expectedCode -> let! bodyStr = Response.readBodyAsString response
                                       return bodyStr
    | code -> return failwithf "Return: %i" code
  }
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 18:45
I meant more actors code ;)
Vlad Kosarev
@vladkosarev
Apr 08 2016 18:46
@Horusiath spawnDrone is the actor that executes actual 'code' - https://github.com/vladkosarev/PerfBench/blob/master/src/PerfBench/PerfBench.fs
@Horusiath I don't want to waste your time, I'll try and figure it out over the weekend. If that async->pipeto snippet is correct then it probably isn't the actor system that's giving me trouble
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 18:52
This message was deleted
Vlad Kosarev
@vladkosarev
Apr 08 2016 18:53
no result, it just needs to not fail
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 18:53
nvm I see
Vlad Kosarev
@vladkosarev
Apr 08 2016 18:53
all I care about is for it not failing and I want to time it
that's all
I actually just return () at the end right now since I am just doing https calls and if they pass that's all I care about
Bartosz Sypytkowski
@Horusiath
Apr 08 2016 18:55
just remember not to use () as a message
Vlad Kosarev
@vladkosarev
Apr 08 2016 18:56
yeah, no problem there, I wrap the return in a message
again, at this point I don't think it has anything to do with akka, it's something else I'm doing
thanks for checking it out
rajivharris
@rajivharris
Apr 08 2016 19:23

Hi, I am still learning the actor programming model
my actorsystem setup looks something like this
Actorsystem
-> CoodrinatorActor (
"/CoordinatorActor/WorkerActor": {"router": "round-robin-pool","nr-of-instances": "3" }
OneForOneStrategy(ex => Directive.Restart))
-> WorkerActor1
-> WorkerActor2
-> WorkerActor3

On exception, the coordinator actor restarts all the child workers, instead of just restarting the fault one. Where I am doing it wrong

Chris G. Stevens
@cgstevens
Apr 08 2016 19:41
@rajivharris This should help. Sounds like you want to do the One-For-One instead of All-For-One.
http://getakka.net/docs/concepts/supervision
rajivharris
@rajivharris
Apr 08 2016 20:12

Thanks @cgstevens. Actually I followed the akka.net docs to design the actorsystem, and I have One-For-One strategy in place. But looks like all the child actors are restarted when an exception occurs

My code:
CoordinatorActor.cs
protected override SupervisorStrategy SupervisorStrategy() { return new OneForOneStrategy(ex => Directive.Restart); }

This is what I see in the log
[Error] [akka://ActorSystem/user/CoordinatorActor/WorkerActor/$c] "Invalid data"
[Error] [akka://ActorSystem/user/CoordinatorActor] "Invalid data"
System.Exception: Invalid data
[Debug] [akka://ActorSystem/user/CoordinatorActor/WorkerActor] "Restarting"
[Debug] [akka://ActorSystem/user/CoordinatorActor/WorkerActor] "Restarted (Akka.Routing.RouterPoolActor)"
[Debug] [akka://ActorSystem/user/CoordinatorActor/WorkerActor/$c] "Restarting"
[Debug] [akka://ActorSystem/user/CoordinatorActor/WorkerActor/$c] "Restarted (Remedy.Service.Core.Actors.RemedyCreateWorkerActor)"
[Debug] [akka://ActorSystem/user/CoordinatorActor/WorkerActor/$b] "Restarting"
[Debug] [akka://ActorSystem/user/CoordinatorActor/WorkerActor/$b] "Restarted (Remedy.Service.Core.Actors.RemedyCreateWorkerActor)"
[Debug] [akka://ActorSystem/user/CoordinatorActor/WorkerActor/$d] "Restarting"

Bartosz Sypytkowski
@Horusiath
Apr 08 2016 20:28
@rajivharris you've specified 1-for-1 rule, but the worker actors are actually hidden behind the router actor. Routers by default propagate errors up to their parents, and the result directive is applied directly on the router itself
since router gets restarted, all of its children are restarted too
try to set supervision strategy right in the router's Prop i.e. Props.Create<WorkerActor>().WithRouter(...).WithSupervisionStrategy(...)
rajivharris
@rajivharris
Apr 08 2016 21:42
@Horusiath Thanks for the code. I moved the supervision strategy to the props of the coordinator actor. But still seeing the same behavior.
  public CoordinatorActor()
            {
                var props =
                    Props.Create<WorkerActor>()
                        .WithRouter(FromConfig.Instance)
                        .WithSupervisorStrategy(new OneForOneStrategy(ex => Directive.Restart));
                _workerActor = Context.ActorOf(props, "Worker");
                Receive<int>(info => HandleRequest(info));
            }