These are chat archives for akkadotnet/akka.net

15th
Jul 2016
Aaron Stannard
@Aaronontheweb
Jul 15 2016 00:02
almost done fixing these DNS issues; just staged a new release of Helios which includes configurable IP family resolution for DNS
that should solve all of the public-hostname bugs folks reported right after the 1.1 release
going to set the default back to IPV4
instead of IPV6
but if you really want IPV6 everywhere
you can turn that on via config
Corneliu
@corneliutusnea
Jul 15 2016 00:05
guys, any news about running Akka on top of Azure Service Fabric ? I know there was a project that started a long time ago about it
Aaron Stannard
@Aaronontheweb
Jul 15 2016 00:06
@corneliutusnea we have people using it in production with ASF today
I'm planning on giving it a spin myself shortly
@mmisztal1980 has done some proof of concept work with it pretty recently
qwoz
@qwoz
Jul 15 2016 00:12
I'm looking forward to @mmisztal1980 's writeup on that (nudge) :)
Corneliu
@corneliutusnea
Jul 15 2016 00:13
any guidance on such a deployment ? do I still need Lighthouse-es with known IPs ?
Aaron Stannard
@Aaronontheweb
Jul 15 2016 00:13
should be able to use the SF APIs to bootstrap a node
i.e. dynamically resolve a seed by calling those methods to get IPs of other "up" nodes
and inject that into config
but I say that not actually having done it
so YMMV
Corneliu
@corneliutusnea
Jul 15 2016 02:36
@Aaronontheweb once you spin it, drop some notes or write a blog. I'd love to give it a spin but really can't these days .. maybe after my ski holidays :snowboarder:
Maciek Misztal
@mmisztal1980
Jul 15 2016 04:38
right-o :)
Arsene T. Gandote
@Tochemey
Jul 15 2016 06:41

Hello with the Akka.TestKit can I use the ask pattern like this:

            var actor1 = Sys.ActorOf(Props.Create(() => new MobileMoney()));
            await
                actor1.Ask<Completed>(new Debit("",
                    "+233247063817",
                    "me",
                    new decimal(2.00),
                    DateTime.Today,
                    string.Empty,
                    string.Empty))
                    .PipeTo(TestActor);
            var result = ExpectMsg<Completed>();
            Assert.Equal("0000", result.TransactionStatus);

Also the test is running in a kind of infinite loop. Any help?

Bart de Boer
@boekabart
Jul 15 2016 06:45
Ask not needed
I supposed actor1 responds to 'Sender' ?
all you need is actor1.Tell(new Debit(...) [, TestActor])
(the testActor part is optional, it's the default sender in TestKit)
then the ExpectMsg
Arsene T. Gandote
@Tochemey
Jul 15 2016 06:54
@boekabart : The MobileMoney Actor has two child actors, One validate and upon validation message the second one perform the actual Debit. However the MobileMoney actor uses the ask pattern + pipeTo to send messages to the children. How best do you think I can test this flow?
Bart de Boer
@boekabart
Jul 15 2016 07:07
well you test the 'external contract' of the outer actor, not it's innards (the fact that/whether it uses children)
Arsene T. Gandote
@Tochemey
Jul 15 2016 07:23
Is it a good pratice that my test fails to respond with 3 seconds?
Peter Hvidgaard
@hvidgaard
Jul 15 2016 07:29
Anyone that can tell me the difference between PersistentActor and ReceivePersistentActor? The documentation doesn't say much about it and the code is not really clear. Is one becoming deprecated perhaps?
Bart de Boer
@boekabart
Jul 15 2016 07:54
@hvidgaard exactly like (Un)typedActor and ReceiveActor.
ReceivePersistentActor you set up the behaviour like Command<string>( cmd => MyMethod(cmd) )
@Tochemey depending on the amount of work your actor does, I'd say that if it doesn't respond within 3 seconds, something is wrong and basically, it doesn't respond. Put breakpoints in your actors and start debugging ;)
@Tochemey also, using Ask<> within an actor is an anti-pattern.
Bart de Boer
@boekabart
Jul 15 2016 08:01
Instead of child.Ask<smth>( debitMsg ).PipeTo(sender); (you must close over sender first in that case), you should child.Tell( debitMsg, Sender); which does the same thing much more efficiently. Effectively it 'fakes' the Sender, so that the child (who, I assume, responds to the Sender), will reply directly to the original Sender rather than to the validator/parent.
(note that if you did NOT close over your Sender (copy it to a local variable before the Ask<>, that's probably why it doesn't work: in the sync continuation, getting Sender is no longer valid and will most likely throw an InvalidOperationException)
Bart de Boer
@boekabart
Jul 15 2016 08:06
Final optimisation: in case the 'debitMsg' you send to the child is the exact message you receive in your validator, you can just 'child.Forward(debitMsg)' and Akka.net will keep the Sender the original. So
Receive<DebitMsg>(debitMsg => { if (IsValid(debitMsg)) child.Forward(debitMsg); else Sender.Tell( "nope" ); });
Peter Hvidgaard
@hvidgaard
Jul 15 2016 08:13
@boekabart Now that you say it, it is obvious. But I still haven't figured out the benefit/drawbacks of each and when to use them. Do you have a link to some documentation about it? Or insight for that matter?
Bart de Boer
@boekabart
Jul 15 2016 08:19
@Aaronontheweb would be a good source for that, but in general, ReceiveActors are the way to go if the behaviour is 'changing' over the actor's lifetime (modelling state machine).
But I tend to use them almost always - I guess the typed/untyped actors might have a lower memory footprint since their behaviour is 'class static' and not dynamic (in memory). Might also be a bit faster.
Arsene T. Gandote
@Tochemey
Jul 15 2016 08:28
Are Dictionary safe in an Actor as state property?
Maciek Misztal
@mmisztal1980
Jul 15 2016 08:33
yes
you needn't worry about concurrent access, since the actor can only process as single message at a time
Arsene T. Gandote
@Tochemey
Jul 15 2016 09:01
@boekabart So you suggest I should use the forward instead of the Ask- PipeTo pattern.
Bart de Boer
@boekabart
Jul 15 2016 09:01
strongly
PipeTo is really only meant for true async continuations, for example, after doing a web call or file I/O
and Ask is only for interacting with the actor system from the 'outside' eg. in a Http Request handler etc., not for use in actors
Maciek Misztal
@mmisztal1980
Jul 15 2016 09:12
@Tochemey you shouldn't use Ask in Actor to Actor communication, it's far better to either do a Sender.Tell or to pass the IActorRef around in a message. http://bartoszsypytkowski.com/dont-ask-tell-2/
Arjen Smits
@Danthar
Jul 15 2016 09:25
@hvidgaard @boekabart performance difference between ReceiveActor and UntypedActor is very small. Internally in the akka.net codebase we migrated away from UntypedActor because of readability reasons. The ReceiveActor allows for much better code.
Peter Hvidgaard
@hvidgaard
Jul 15 2016 09:25
So I should be using RecieveActor unless I have a specific reason for UntypedActor
Arjen Smits
@Danthar
Jul 15 2016 09:28
yes
In my mind UntypedActor exists to provide an actor implementation that is just above an bare-metal actor. For people who want to build their own actor type, but find ReceiveActor to be just abit to high level, but dont want to go bare metal either.
Peter Hvidgaard
@hvidgaard
Jul 15 2016 09:31
Sounds reasonable.
Arjen Smits
@Danthar
Jul 15 2016 09:32
I think most users will be fine with ReceiveActor.
An example of building your own actor type implemenations: https://github.com/SaladLab/Akka.Interfaced
In this example, they are doing probably more then most people would ever want to do :P
but its an example of using the UntypedActor as an baseclass for your own actor type
because: reasons
Peter Hvidgaard
@hvidgaard
Jul 15 2016 09:35
hehe, it's good to know it's possible, meanwhile I'll use RecieveActor for everything
Peter Hvidgaard
@hvidgaard
Jul 15 2016 09:44
What about dymically subscribing to events. Should I be using the EventBus, or create a router add my Actors to that dynamically, or even make a dedicated Actor for that? I've found some advice from 2012 on google groups, that say use the EventBus - is that still the prefered way?
Arsene T. Gandote
@Tochemey
Jul 15 2016 10:00
@boekabart Talking about the testing. As I said I have an Actor let us say MobileMoney. It has two child Actors Validator and Payer. MobileMoney forward validation message to Validator. The latter responds to MobileMoney of a validation done message. Based upon the state of validation done message MobileMoney then forward the payment message to the Payer and expect a completed message. However when I run the test on the MobileMoney it fails saying that instead of the completed message it has received the validation done message. I would like to know how to go about that chain of processes.
Arjen Smits
@Danthar
Jul 15 2016 10:18
@hvidgaard The eventbus is the easiest way to do that yes. If you need some custom logic and state management surrounding your subscription and publication process then a custom Actor is an option.
Garrard Kitchen
@garrardkitchen
Jul 15 2016 11:25

Hi @Horusiath, I’m following your example (http://bartoszsypytkowski.com/how-create-an-akka-net-cluster-in-f/) but with using mono (usng mac os) and every time a node joins the seed I get this:

reated an actor on node [akka.tcp://my-system@127.0.0.1:9000] with roles [seed]
Received: Akka.Cluster.ClusterEvent+CurrentClusterState
[ERROR][15/07/2016 11:20:12][Thread 0013][Akka.Remote.Transport.Helios.TcpServerHandler] Error caught channel [::ffff:127.0.0.1:9000->::ffff:127.0.0.1:54989](Id=ChannelId(-2029685376))
Cause: System.Net.Sockets.SocketException: interrupted
  at Helios.Channels.Sockets.TcpSocketChannel.DoReadBytes (IByteBuf buf) <0x33df9a8 + 0x0016f> in <filename unknown>:0
  at Helios.Channels.Sockets.AbstractSocketByteChannel+SocketByteChannelUnsafe.FinishRead (Helios.Channels.Sockets.SocketChannelAsyncOperation operation) <0x33df058 + 0x0012b> in <filename unknown>:0

I’m using 1.1. Any ideas?

Bartosz Sypytkowski
@Horusiath
Jul 15 2016 11:43
@garrardkitchen not sure, I know that 1.1 has some confirmed problems when it comes to DNS. @Aaronontheweb will know more
Arsene T. Gandote
@Tochemey
Jul 15 2016 11:48
@boekabart Talking about the testing. As I said I have an Actor let us say MobileMoney. It has two child Actors Validator and Payer. MobileMoney forward validation message to Validator. The latter responds to MobileMoney of a validation done message. Based upon the state of validation done message MobileMoney then forward the payment message to the Payer and expect a completed message. However when I run the test on the MobileMoney it fails saying that instead of the completed message it has received the validation done message. I would like to know how to go about that chain of processes. Please can any one help on this.
Maciek Misztal
@mmisztal1980
Jul 15 2016 16:24
hey guys, can anyone elaborate on the status of Akka.Cluster on mono ?
Aaron Stannard
@Aaronontheweb
Jul 15 2016 17:29
@garrardkitchen yeah, 99% shot that's the DNS issue
basically DNS is now defaulting to IPV6
in the new transport
so if you combined public-hostname=DNS, hostname=IPV4
shit will not work
carsten jørgensen
@carstenj_twitter
Jul 15 2016 17:29
What is the preferred way to keep a #fsharp #mono based exe alive running in a @docker container? The exe hosts @AkkaDotNET actors
Aaron Stannard
@Aaronontheweb
Jul 15 2016 17:29
working on fixing that now
now if it's not a DNS issue
the socket interruption exception would indicate that the underlying socket is being closed during a read
we changed the underlying way sockets work in Helios 2.1.2 to use socket async event args
so the underlying mechanism being used is now different
we threw in the towel on trying to do CI on Mono a while back; too many issues with XUnit in particular
this included efforts such as compiling Mono from source to get the latest changes, etc
@carstenj_twitter cc @annymsMthd
Aaron Stannard
@Aaronontheweb
Jul 15 2016 17:46
@garrardkitchen I'll spend some time today kicking the tires on Mono
see if there's a quick fix there
Aaron Stannard
@Aaronontheweb
Jul 15 2016 18:08
if you're interested in helping work on the Akka.NET support for .NET Core, we've created a special room for coordinating efforts on that: https://gitter.im/akkadotnet/dotnet-core cc @adamhathcock
that's mostly to make it easy for contributors / beta users to keep track of what's happening inflight there
not for asking general questions
that's what the main room is for
either way - if you're interesting in getting Akka.NET onto .NET Core faster, join that room :p
Garrard Kitchen
@garrardkitchen
Jul 15 2016 18:21
@Aaronontheweb Thanks, that’ll be a huge help. Ran same codebase againsts windows and worked as designed. It’s my first real outing with mono. Using F# too. Building cloud service to live in docker cloud with BYON (Azure). Not sure if this helps…hostname is IPV4 and public is commented out. Let me know if I can help?
Steven Mitcham
@smitcham
Jul 15 2016 18:30
Hello, new Akka.net user here. Are there any examples of combining the FSM actors with the cluster.sharding capability? Is it is the same information as the persistent actor w/sharding in the docs?
fouimette
@fouimette
Jul 15 2016 19:51
Does Terminate() perform what used to be ShutDown() and AwaitTermination()?
and how would I use WhenTerminated?
wdspider
@wdspider
Jul 15 2016 19:58
I believe that Terminate replaces Shutdown and WhenTerminated replaces AwaitTermination..... I tend to use it like this:
_actorSystem.Terminate();
_actorSystem.WhenTerminated.Wait();
and if you are also using the Clustering stuff @ZoolWay created some graceful shutdown samples here: https://github.com/ZoolWay/akka-net-cluster-graceful-shutdown-samples
Marc Piechura
@marcpiechura
Jul 15 2016 20:01
@fouimette @wdspider Terminate does the same as Shutdown and then returns WhenTerminated internally so you can replace these two calls to one and directly call .Wait on the Termiante call
wdspider
@wdspider
Jul 15 2016 20:04
ah, thanks for clarifying.
fouimette
@fouimette
Jul 15 2016 20:04
thank you
Marc Piechura
@marcpiechura
Jul 15 2016 20:05
WhenTermianted can be used if you need to wait anywhere else in then code for the termination
np
fouimette
@fouimette
Jul 15 2016 20:32
How can I clear out the dead letter that have accumulated in my test demo?
Aaron Stannard
@Aaronontheweb
Jul 15 2016 20:51
@smitcham yep, you should be able to use a PersistentFSM with Cluster Sharding
don't know of an example
but it shouldn't be any different than any other persistent actor in terms of its behavior or setup
@fouimette dead letters are ephemeral - they're automatically logged and forgotten about unless you intercept them yourself
if you want to turn off deadletter logging there's an option for that in HOCON
Steven Mitcham
@smitcham
Jul 15 2016 20:53
@Aaronontheweb thanks
I've got a PR in the Akka.DI.Unity project that updates to Unity 4, I wasn't sure whether there should be a totally different package for that since Unity >= 4 is not backwards compatible with 3.5. I've created a local package in our companies nuget feed, but it would be nice to get the full package up there.
Aaron Stannard
@Aaronontheweb
Jul 15 2016 20:58
IMHO - best thing to do is to submit a pull request and see if anyone comments on it saying "OMG NO THIS WILL BE {x}"
I think it should be fine to upgrade it personally, but yeah
it's the responsibility of the people using it, at the end of the day
Steven Mitcham
@smitcham
Jul 15 2016 20:59
The PR is already up if anyone wants to approve it.
Aaron Stannard
@Aaronontheweb
Jul 15 2016 20:59
to speak up / take ownership of an OSS thing they care about
I'll go take a look now
fouimette
@fouimette
Jul 15 2016 20:59
@Aaronontheweb Thanks!
Aaron Stannard
@Aaronontheweb
Jul 15 2016 21:01
@smitcham FYI
In order to do a release, we need to do the following:
  • Update RELEASE_NOTES.md with a new version bump. Follow the convention there.
  • Submit a PR to the master branch once all of the changes have been brought in.
would you consider sending in another PR to do that?
Steven Mitcham
@smitcham
Jul 15 2016 21:01
sure.
Aaron Stannard
@Aaronontheweb
Jul 15 2016 21:01
and maybe upgrade to Akka.NET 1.1?
thanks, that'd be a big help
Steven Mitcham
@smitcham
Jul 15 2016 21:02
also sure. I put that in a while back.
Aaron Stannard
@Aaronontheweb
Jul 15 2016 21:03
I meant upgrade the package :p
so we can release it with updated dependencies
Steven Mitcham
@smitcham
Jul 15 2016 21:03
yep
Aaron Stannard
@Aaronontheweb
Jul 15 2016 21:05
@corneliutusnea heh, I'll give that a shot
going to be starting on that project soon-ish
Aaron Stannard
@Aaronontheweb
Jul 15 2016 21:12
@smitcham doh, found a bug in the Akka.DI.TestKit because of that: akkadotnet/Akka.DI.Unity#4
already have a fix up for it: akkadotnet/akka.net#2189
fouimette
@fouimette
Jul 15 2016 21:19
Is there a list of Hocon configuration options? I am looking for that dead letter logging option. Even better, where in the source can i find this option?
Steven Mitcham
@smitcham
Jul 15 2016 21:45
@Aaronontheweb Here's the updated pull request. Let me know if it needs anything else akkadotnet/Akka.DI.Unity#5