Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 10:12
    cptjazz synchronize #4242
  • Feb 22 12:02
    cptjazz opened #4242
  • Feb 21 19:37
    Arkatufus synchronize #4228
  • Feb 21 19:37
    Arkatufus ready_for_review #4228
  • Feb 21 15:42
    Aaronontheweb assigned #4241
  • Feb 21 15:42
    Aaronontheweb milestoned #4241
  • Feb 21 15:42
    Aaronontheweb labeled #4241
  • Feb 21 15:42
    Aaronontheweb labeled #4241
  • Feb 21 15:42
    Aaronontheweb labeled #4241
  • Feb 21 15:42
    Aaronontheweb opened #4241
  • Feb 21 01:47
    Arkatufus opened #4240
  • Feb 21 00:10
    Aaronontheweb synchronize #4212
  • Feb 20 23:50
    Aaronontheweb synchronize #4238
  • Feb 20 23:48
    Aaronontheweb commented #4234
  • Feb 20 23:47
    Aaronontheweb synchronize #4212
  • Feb 20 23:46

    Aaronontheweb on dev

    close #4234 - added CachingConf… (compare)

  • Feb 20 23:46
    Aaronontheweb closed #4239
  • Feb 20 23:46
    Aaronontheweb closed #4234
  • Feb 20 23:25
    Aaronontheweb synchronize #4239
  • Feb 20 23:24
    Aaronontheweb opened #4239
Bartosz Sypytkowski
@Horusiath
@jalchr are you trying to get children of your sharded actor? Or do you want to check which sharded actors are currently active within the shard?
jalchr
@jalchr
The second option
Bart de Boer
@boekabart
I have a question about basic Akka.Net, no remoting/clustering. It's about Dispatcher behaviour, I think.
I have a pipeline of actors (read xml to many fragments, process the fragments (in various ways, in about 3 parallel pipelines), then aggregate into a single actor, that outputs 'arrays' each N seconds, to a Serializer actor and then to a WriteFileContents actor.
What I observe, and this is unexpected, is that when I'm reading a 200.000 fragment xml file, I do quickly see some entities ending up in my 'buffer' , which gets triggered to output every 10 seconds, and it does output every 10 seconds roughly. However, it seems that under the 'load' of those many, many entities in the 'upstream' part of the system, that the couple of messages at the 'downstream' (after the buffer) get handled only VERY sporadically - at least less than once every 10 seconds (meaning that i'm going to write multiple files in the same second)
so it seems the default dispatcher behaviour doesn't help me to quickly 'stream' the pieces of data all the way to the end, it seems to prefer moving the entire bulk through the pipeline slowly ('breadth-first' instead of 'depth-first').
Bart de Boer
@boekabart
I would have thought that the default 100 messages limit on the mailbox processing (throughput ) would prevent that, and would give all actors a chance to handle their messages constantly (sub-second intervals). The processing of each message definitely does not take 1/10th second or even close to that.
Rohan Relan
@hanrelan
hi
i have a question about debugging when using akka
I'm getting an "Exception thrown: 'System.ArgumentNullException' in Akka.dll"
in my output window but I can't see the line number of the exception
or any other information
is there a way to get Akka to allow exceptions to raise as normal within actors
Rohan Relan
@hanrelan
or to get the stacktrace for the exception
Bart de Boer
@boekabart
step 1 would be to un-set 'just my code' in Visual Studio , and maybe enable all breaking on this particular exception (even if caught) in debug exception settings
then hope you can get the symbols downloaded...
Rohan Relan
@hanrelan
hmm i think i found the problem
potentially I was sending null to PipeTo
I'm not sure if that's allowed
Bart de Boer
@boekabart
I'm sure it's not ;)
HermansG
@HermansG
We encounter regularly the need that the behaviour of an actor must have one or more Receive methods in common for all states. In such cases we use a General()' method that is executed in every state transistionBecome(..). Is this a bad design? When not, is there an easier possibility in Akka to defineRecieve`-behaviours for all states?
Alexander Dorfman
@alexander-dorfman
Hi my name is Alexander, I work for big logistics company and recently discovered Akka (and similar Actor-Based frameworks). Today, I started going through internals of Akka, by stepping through the tests/benchmarks (PingPong in particular) in debug mode. What I am finding, is that for some of the internal classes, there is no documentation , only "TBD".
Would it be a good idea, if I can document some of the classes marked with "TBD" ?
Bartosz Sypytkowski
@Horusiath
@alexander-dorfman TBD markers have been generated by the tools to mark missing parts of the xml docs. Contributions on that field are always valuable.
Alexander Dorfman
@alexander-dorfman
@Horusiath Awesome ! I will see what I can do
Bart de Boer
@boekabart
@HermansG we do exactly the same - we just call it OnBecome()
ForrestWang
@ForrestWang

Hi, we use Akka.net for a while in our production environment already. recently, we are looking at Akka.net streams, and I have a question about it.

Let's say I have an Order class.

class Order {
public string OrderID {get;set;}
...
}

the logic is, we collect a bunch of orders and transform, save to database, a typically ETL process.

the prototype could be like this:

List<Order> orders = new List<Order>();

orders.add(new Order("orderID1"));
orders.add(new Order("orderID2"));

Source.From(orders).select(x=>x.OrderID = x.OrderID + "123").RunForeach(Console.WriteLine());

After that, obviously, the original order collection, each order's ID has _123 appended, so my question is, through each flow, should I create a new instance of Order and transform on the new instance, then pass the new one to the next flow, in other words, keep the original collection element immutable.

Bart de Boer
@boekabart
Yes, 1000 times yes. Just make it a habit to make your 'message' classes/structs immutable (so, eg. no {get; set;} , just { get; } and constructor setting.
Paweł Bańka
@pmbanka

Hi! I have a problem with clustering. I have 2 nodes which use sharding, and some lighthouses. After I restarted the nodes, they joined the cluster without issues, but the sharded actors cannot be spawned. The errors I get look like this:

Trying to register to coordinator at ["/system/sharding/ps_filesCoordinator/singleton/coordinator"], but no acknowledgement. Total [1600] buffered messages.

And there is a ton of them spamming all the time. The root cause seems to be related to restoring state of shard coordinator

{
  "Depth": 0,
  "ClassName": "System.ArgumentException",
  "Message": "Region [akka://Oddjob/system/sharding/ps_files#1292415200] not registered\r\nParameter name: e",
  "Source": "Akka.Cluster.Sharding",
  "StackTraceString": "   at Akka.Cluster.Sharding.PersistentShardCoordinator.State.Updated(IDomainEvent e)\r\n   at Akka.Cluster.Sharding.PersistentShardCoordinator.ReceiveRecover(Object message)\r\n   at Akka.Persistence.Eventsourced.<RecoveryStarted>b__90_0(Object message)\r\n   at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)\r\n   at Akka.Persistence.Eventsourced.<>c__DisplayClass92_0.<Recovering>b__0(Receive receive, Object message)",
  "RemoteStackTraceString": null,
  "RemoteStackIndex": 0,
  "ExceptionMethod": {
    "Name": "Updated",
    "AssemblyName": "Akka.Cluster.Sharding",
    "AssemblyVersion": "1.3.2.0",
    "AssemblyCulture": "",
    "ClassName": "Akka.Cluster.Sharding.PersistentShardCoordinator+State",
    "Signature": "State Updated(IDomainEvent)",
    "MemberType": 8
  },
  "HResult": -2147024809,
  "HelpURL": null
}


Exception in ReceiveRecover when replaying event type ["Akka.Cluster.Sharding.PersistentShardCoordinator+ShardHomeAllocated"] with sequence number [8] for persistenceId ["/system/sharding/ps_filesCoordinator/singleton/coordinator"]

The wierd thing is that it fails on sequence number 8 when there is 21 entries in the DB.

Any pointers on what could be the cause of the error here? I don't understand what "Region not registered" means :|

(I know that I can probably fix it by purging the DB, but I'd like to understand why is it happening).

jalchr
@jalchr
wilddeveloperappears
@wilddeveloperappears
Hi, I'm trying to set the result of Context.GetLogger() at runtime to something different. Is this possible, and how would I do this? I don't want to use the Hocon to do this, because I want the logging infrastructure to do something unique for each ActorSystem that's running.
ryzam
@ryzam

Hi guys, I'm doing a demo project using akka cluster and facing a problem to send message to the cluster actor. Already run Lighthouse project as Seed-Nodes and I also can deploy the actor remotely and having actor reference but the actor are not able to receiving a message. If i change user-role=api then it can receive a message

class Program
    {
        static void Main(string[] args)
        {
            var config = ConfigurationFactory.ParseString(@"
                akka {
                        actor { 
                            provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster""
                        }

                        remote {
                            log-remote-lifecycle-events = DEBUG
                            dot-netty.tcp {    
                                hostname = ""127.0.0.1""
                                port = 5001
                            }
                        }            

                        cluster {
                            #will inject this node as a self-seed node at run-time
                            seed-nodes = [""akka.tcp://akkademo@127.0.0.1:4053""]
                            roles = [actorserver]
                        }
                    }
            ");
            using (ActorSystem system = ActorSystem.Create("akkademo",config))
            {
                Console.ReadLine();
            }
        }
    }

and here is the API cluster side

    class Program
    {
        static void Main(string[] args)
        {
            var config = ConfigurationFactory.ParseString(@"
                akka {
                        actor { 
                            provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster""

                            deployment {
                                /actorServerGraphQL  {
                                   router = round-robin-pool
                                   nr-of-instances = 10
                                   cluster {
                                      enabled = on
                                      max-nr-of-instances-per-node = 2
                                      allow-local-routees = on
                                      use-role = actorserver
                                   }
                                }
                            }
                        }

                        remote {
                            log-remote-lifecycle-events = DEBUG
                            dot-netty.tcp {    
                                hostname = ""127.0.0.1""
                                port = 5002
                            }
                        }            

                        cluster {
                            #will inject this node as a self-seed node at run-time
                            seed-nodes = [""akka.tcp://akkademo@127.0.0.1:4053""]
                            roles = [api]
                        }
                    }
            ");
            using (ActorSystem system = ActorSystem.Create("akkademo", config))
            {



                var actorServer = system.ActorOf(Props.Create<ActorServerGraphQL>().WithRouter(FromConfig.Instance), "actorServerGraphQL");


                actorServer.Tell(new QueryDatabase("Start query"));

                //var apiActor = system.ActorOf(Props.Create(() => new ApiActor(actorServer)), "apiActor");


                //apiActor.Tell(new QueryDatabase("Start query"));


                Console.ReadLine();
            }
        }
    }
Bartosz Sypytkowski
@Horusiath

Do you think this might help ? http://getakka.net/articles/clustering/cluster-sharding.html#retrieving-sharding-state

@jalchr sorry, but I'm out of the context.

jalchr
@jalchr
@Horusiath regarding the Getting the children for a shard ...
Bartosz Sypytkowski
@Horusiath
yes, if you need to know about alive entities living in the same shard
I've wrote once a blog post where I've described all query messages, that can be used to communicate with cluster sharding: https://petabridge.com/blog/cluster-sharding-technical-overview-akkadotnet/#getting-shard-metadata
jalchr
@jalchr
On GetShardRegionState shard region will reply with ShardRegionState containing data about shards living in the current actor system and what entities are alive on each one of them.
On GetClusterShardingStats shard region will reply with ClusterShardingStats having information about shards living in the whole cluster and how many entities alive in each one of them.
okay ... this gives info about "All active Shards" ... not a single one ... right ?
very well ...
Bartosz Sypytkowski
@Horusiath
@wilddeveloperappears you still can set up a separate HOCON config for each ActorSystem, with different logging in mind. In general it's not possible to setup a separate logging adapter per actor, as logging is running within actor system event stream. It doesn't discriminate different actors.
@jalchr yes, for a single shard, you have corresponding message types described bellow in the same article
jalchr
@jalchr

How can I query for the stats ? Is it a Tell or Ask ?

 _shard.Ask< ?? >(Shard.GetCurrentShardState.Instance);

or

 _shard.Tell(Shard.GetCurrentShardState.Instance);

and How I can get the response out of a 'Tell' ??

Bartosz Sypytkowski
@Horusiath
shard.Ask<Shard.CurrentShardState>(Shard.GetCurrentShardState.Instance); - it's described there, by convention query names have Getxxx prefix, while replies don't
with Tell, shard will simply respond to a message sender (an actor)
jalchr
@jalchr
Oops ... I missed that in the documentation ... strongly appreciated
jalchr
@jalchr
@Horusiath I'm getting this error:
2017-12-09 11:20:41,542 [33] WARN  Akka.Cluster.Sharding.ShardRegion - Message does not have an extractor defined in shard [FileHandler] so it was ignored: Akka.Cluster.Sharding.Shard+GetCurrentShardState
Bartosz Sypytkowski
@Horusiath
to which actor do you send that message?
it looks like you're trying to contact with sharded actor instead of shard itself
jalchr
@jalchr
I think so ... here is what I'm doing:
            _shard = ClusterSharding.Get(Context.System).ShardRegion(nameof(FileHandler));
            var state = _shard.Ask<Shard.CurrentShardState>(Shard.GetCurrentShardState.Instance).Result;
            var exists = state.EntityIds.Contains(newVideo.File.ToLower());
How to talk with the "shard" itself ?
Bartosz Sypytkowski
@Horusiath
@jachlr in your case _shard is actually ShardRegion. General notion is that:
  • Actors managed by cluster sharding often are referred to as entities
  • Entities are grouped in shards. Entities within the same shard always live on the same machine, when they are rebalanced to another one, they are always rebalanced together. If you want to get reference to target shard, keep in mind that shard is an actor parent for it's entities (so you can use Context.Parent from within entity).
  • Shards themselves are grouped within shard regions. Shard region is a container for all shards of a given actor type living on a target actor system.
jalchr
@jalchr
@Horusiath I think I understand the terminology. But it would clearer if translated to code.
So _shard is a region.
How do I query for the "shard state" ... ?
Bartosz Sypytkowski
@Horusiath
lets first define, what information do you really want to get? "shard state" is very broad
jalchr
@jalchr
Very well, my ApiMaster is trying to launch a new "File Processing" operation .. I'm trying to detect if a 'job' is already running or not
private void HandleFindRunningJob(FindRunningNewVideo newVideo)
        {
            //var state = _shard.Ask<Shard.CurrentShardState>(Shard.GetCurrentShardState.Instance).Result;
            //var exists = state.EntityIds.Contains(newVideo.File.ToLower());

            var haveChild = Context.Child(newVideo.File.ToLower());
            if (haveChild != ActorRefs.Nobody)
            {
                ApiBroadcaster.Tell(new NewVideoFound(newVideo.File));

                _mediator.Tell(new Publish(Topics.Reporting, new ReportStatus(ReportStatusEnum.Info,
                    $"HandleFindRunningJob() : 'already processed' file = {newVideo.File}"
                    )));
                _logger.Info($"HandleFindRunningJob() : 'already processed' file = {newVideo.File}");

            }
        }