These are chat archives for akkadotnet/akka.net

10th
Aug 2015
Sean Gilliam
@sean-gilliam
Aug 10 2015 03:18

we passed 10,000 downloads of the core Akka package on NuGet this past week https://www.nuget.org/packages/Akka/ - didn't even notice

nice

Bartosz Sypytkowski
@Horusiath
Aug 10 2015 05:44
@rdavisau I guess this is because, when you were using ask operator <? and got output, you didn't choose to cast it to any concrete type - therefore the result is JObject actually
Ryan Davis
@rdavisau
Aug 10 2015 06:36

@Horusiath thanks, but the output I pasted was showing at the message target end (it's true I was using ask on the sender side). I have simplified to a single FSI script and no action taken (just printing message). Given a basic DU:

type Message =
    | Marco
    | LogLocal of string
    | Echo of string

Deploy actor of spawn system "simpleton" (actorOf (fun msg -> printfn "%A" msg)) on cluster node port 54054
and tells from fsi:

(select "akka.tcp://cluster@localhost:54054/user/simpleton" host) <! "s"
(select "akka.tcp://cluster@localhost:54054/user/simpleton" host) <! LogLocal("s")

The first tell is fine. The second yields:

AssociationError [akka.tcp://cluster@localhost:54054] <- akka.tcp://cluster@localhost:54050: Error [Object reference not set to an instance of an object.] [   at Akka.Serialization.NewtonSoftJsonSerializer.TranslateSurrogate(Object deserializedValue, ActorSystem system, Type type)

Is there anything here I'm obviously messing up? I am going to reference the akka dlls locally so I can step through the code but maybe you have seen something like this before..

Bartosz Sypytkowski
@Horusiath
Aug 10 2015 06:40
@rdavisau I will need to check that, could you send me a gist with an example, so I could reproduce it?
Ryan Davis
@rdavisau
Aug 10 2015 07:17
@Horusiath thanks - I've created a basic gist here
Ryan Davis
@rdavisau
Aug 10 2015 07:34
@Horusiath arghhh I realised that in consolidating the scripts to try and simplify I've ended up with Json 6.something being bound instead of 7.01. It's possible that it all works and I'm just bad at life.. don't waste any time till I've confirmed
Roger Johansson
@rogeralsing
Aug 10 2015 07:40
What do you think about this? akkadotnet/HOCON#14 what if hocon could fallback to point to web/app config values? that way, you can still have values that are transformed via config transforms inside hocon
the connectionstring thing for akka persistence could have been solved that way
Arjen Smits
@Danthar
Aug 10 2015 07:43
That sounds like a really good idea. I like it.
Roger Johansson
@rogeralsing
Aug 10 2015 07:52
so what keys should we allow users to fallback to? keys and connectionstrings ? or try to navigate the XML using hoconpaths somehow?
Arjen Smits
@Danthar
Aug 10 2015 07:58
do we have any scenario's for falling back to anything other then appsetting-keys and connectionstrings ?
Natan Vivo
@nvivo
Aug 10 2015 08:13
I like the idea, but isn't this being implemented in a broader way into .net's new config system?
Marc Piechura
@marcpiechura
Aug 10 2015 08:50
Could someone maybe take a look at #1210 ? I think I messed up to merge changes from upstream into my local fork... Maybe it wasn't the best idea to do it inside visual studio ;) And would this be the right approach ? Thanks!
Roger Johansson
@rogeralsing
Aug 10 2015 08:57
@nvivo even if it is, shoudnt we focus on the current framework?
Natan Vivo
@nvivo
Aug 10 2015 09:57
Sure. I meant that maybe there is no need to invest too much effort on it, since we're just 6 months away from a release that will render it obsolete.
But if that is already part of HOCON and simple to implement, why not
Arjen Smits
@Danthar
Aug 10 2015 10:07
It wont be obsolete. If you think the entire .Net world will migrate an-masse to the new .net version, you should think again.
Arjen Smits
@Danthar
Aug 10 2015 10:17
When running the Ping Pong benchmark. What do the red lines mean ?
nvm figured it out
Natan Vivo
@nvivo
Aug 10 2015 10:25
I didn't mean that, was just adding my 2 cents. That's what I'm doing, but I know a lot of people won't.
Bartosz Sypytkowski
@Horusiath
Aug 10 2015 11:06
@Danthar they mean that perf dropped, when compared to previous config case tested
Roger Johansson
@rogeralsing
Aug 10 2015 11:08
@Danthar the benchmark is very flaky, lets say some other process starts hogging cpu, you will notice a perfdrop in the pingpong app. so its only good for seeing aprox how much/little overhead we have in the scheduler / dequeue pipeline
Arjen Smits
@Danthar
Aug 10 2015 11:30
@Horusiath @rogeralsing Yeah i figured that out. (looked at the code). I was using it to diagnose performance problems with an Akka based app.
I used it to compare Akka's performance on machine X vs machine Y
For that its fine
Ryan Davis
@rdavisau
Aug 10 2015 11:48
@Horusiath re: the discriminated union + cluster issue - I got all the references back to the correct versions; for me the gist shows messages sent to a cluster address to be received as seq [seq [seq []]; for the label and additional seq [seq [seq []];s for any component types on the case :incoming_envelope:
Ryan Davis
@rdavisau
Aug 10 2015 11:55
(the host and node parts were pulled together from seperate files so I put them inside functions to contain the variable scope of each - that's why there's a bit of nesting going on)
Bartosz Sypytkowski
@Horusiath
Aug 10 2015 11:59
ok, I'll take a look, but in general this would be hard, because hack that allows discriminated unions serialization has rough edges ;)
Ryan Davis
@rdavisau
Aug 10 2015 12:03
Hopefully they can work; I think they add a lot of power (but also simplicity) to the model!
Bartosz Sypytkowski
@Horusiath
Aug 10 2015 12:08
@rogeralsing concerning DUs, maybe we should write an issue on json.net starting with "still won't work"? I think this is the best option
Bartosz Sypytkowski
@Horusiath
Aug 10 2015 12:51
@nvivo your example on #1227 (listening on events) could be actually solved by combination of pub/sub and persistent actor
persistent actor subscribed to an event in event bus and working as a counter for it
(this doesn't make your statement invalid ofc)
Natan Vivo
@nvivo
Aug 10 2015 14:27
that could work. but what about replaying the events? how do you query the store?
still need some way to do it
what bothers me in this solution is that you have 2 sources of truth for the projection. Suppose you persist the event saying "i got the event X", but the server stops before you actually send the SQL statement to the table - your actor would say you're at one place while the store says you're at another
I'd rather have a single source of truth, going to the table when the actor starts and checking what was the last event I put there
Roger Johansson
@rogeralsing
Aug 10 2015 15:19
@Horusiath totally agree, when the option for serializing typenames for all types are enabled, one would expect that to apply to all types
I was actually looking at the source code for the DU converter earlier today, I thought that it would be possible to copy paste it into akka as we now have dependency on 7.0.. but apparently it uses a lot of internal stuff from json.net.. couldnt be arsed to copy all of it
Roger Johansson
@rogeralsing
Aug 10 2015 15:24
@Horusiath did you have any luck with FsPickle? I couldnt even find a way to deserialize w/o generic args
Christian Palmstierna
@cpx86
Aug 10 2015 15:52
Hi guys, PR for #879 here :) akkadotnet/akka.net#1230
Roger Johansson
@rogeralsing
Aug 10 2015 15:54
nice!
@Horusiath take a look at https://github.com/antmicro/Migrant
trying it out now, it does serialize DU's :) and you dont need to pass the type to get back to the serializer, that is encoded in the stream
looking kind of promising from the little Ive seen so far
Natan Vivo
@nvivo
Aug 10 2015 15:59
@rogeralsing stupid question... what's this "DU" you're talking all the time?
Christian Palmstierna
@cpx86
Aug 10 2015 16:03
@nvivo Discriminated Union
Natan Vivo
@nvivo
Aug 10 2015 16:04
@cpx right! thanks!
Christian Palmstierna
@cpx86
Aug 10 2015 16:04
@nvivo np!
Roger Johansson
@rogeralsing
Aug 10 2015 16:22
@nvivo Json.NET have a hard time dealing with DU's, it does some strange serializaton of them, so that one have been a problem since day one for the F# api
thus, we are looking at other serialziers. but hard to find one that is as flixible as json.net
Natan Vivo
@nvivo
Aug 10 2015 16:35
@rogeralsing right, I remember reading some issues about that now. I don't know anything about all that f# black magic, but shouldn't it be possible to just inspect the type before serializing and producing manually something json.net can understand?
Roger Johansson
@rogeralsing
Aug 10 2015 16:37
one of the problems is nested objects, there can be one normal object with a property of type object which in turn contains a DU.
Natan Vivo
@nvivo
Aug 10 2015 16:38
Does the deserialization work?
Roger Johansson
@rogeralsing
Aug 10 2015 16:48
we have a workaround now that is OK, so currently no major issues, but the problem is still there. e.g. if you pass an F# DU to a C# system, the problem would arise again
Natan Vivo
@nvivo
Aug 10 2015 16:52
got it
Roger Johansson
@rogeralsing
Aug 10 2015 17:34
@Horusiath I'm going to give Migrant a shot, just have to hook our surrogate approach into their (different) surrogate approach. but it looks very good so far
Roger Johansson
@rogeralsing
Aug 10 2015 17:58
heh this sucker can serialize delegates :D
Sean Gilliam
@sean-gilliam
Aug 10 2015 17:59
sweet
Bartosz Sypytkowski
@Horusiath
Aug 10 2015 18:32
what about performance?
Bartosz Sypytkowski
@Horusiath
Aug 10 2015 19:06
this Migrant lib looks really good
almost like it was designed for our use case
Roger Johansson
@rogeralsing
Aug 10 2015 19:23
ye, there is some 1900 tests too, so for a unknown lib, its pretty solid
Bartosz Sypytkowski
@Horusiath
Aug 10 2015 19:24
I'll take a look at it later (already stared it). Right now I'm porting event adapters to persistence, they look pretty handy
Roger Johansson
@rogeralsing
Aug 10 2015 20:01
BAM, 31 out of 34 serialization tests pass on first try :D
Roger Johansson
@rogeralsing
Aug 10 2015 20:28
and there comes the rest of them...
stevemesser
@stevemesser
Aug 10 2015 21:22
This message was deleted
Sean Gilliam
@sean-gilliam
Aug 10 2015 21:34
@stevemesser I'm not sure about the other loggers, but I've used NLog to email logs. Easy to setup as well.
stevemesser
@stevemesser
Aug 10 2015 21:38
Thanks I just found some example configuration in the Lighthouse source
Ryan Davis
@rdavisau
Aug 10 2015 22:05
@rogeralsing re: fspickler, I noticed that the creator removed the non-generic overloads of Serialize/Deserialize a few versions back; hard to know whether it was for technical reasons or just to simplify the API. Anyway the migrant lib sounds promising 🎶