Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 13:23
    Aaronontheweb commented #4096
  • 13:22
    Aaronontheweb commented #4093
  • 13:16
    ismaelhamed commented #4093
  • 13:04
    ismaelhamed edited #4097
  • 13:04
    ismaelhamed opened #4097
  • 12:50
    ismaelhamed commented #4096
  • 12:48
    ismaelhamed commented #4096
  • 12:05
    Aaronontheweb commented #4096
  • 11:43
    ismaelhamed commented #4096
  • Dec 14 19:13
    hwanders commented #4096
  • Dec 14 13:05
    IgorFedchenko commented #4085
  • Dec 14 03:08
    hhko commented #4094
  • Dec 13 21:37
    Aaronontheweb commented #4085
  • Dec 13 20:28
    IgorFedchenko commented #4085
  • Dec 13 20:27
    IgorFedchenko commented #4085
  • Dec 13 15:38
    Aaronontheweb labeled #4096
  • Dec 13 15:38
    Aaronontheweb milestoned #4096
  • Dec 13 15:38
    Aaronontheweb labeled #4096
  • Dec 13 15:38
    Aaronontheweb opened #4096
  • Dec 13 10:41
    peirens-bart opened #4095
Rohan Relan
@hanrelan
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}");

            }
        }
Bartosz Sypytkowski
@Horusiath
is there some kind of 1-1 relation between "job" and a particular actor instance?
Bartosz Sypytkowski
@Horusiath
usually "job" describes some stateless behavior - cluster sharding has more sense in stateful problems (when you have a logical domain entity like User, Department, Vehicle etc.). You don't need to check if entity is alive, as you shouldn't care about that. If it's running, just queue the next message for it, it will be picked up at some point. If it's not alive it will be created ad-hoc and start processing the message.
jalchr
@jalchr

I see what you mean. I have FileProcessing to be a stateful problem. It undergoes several steps. I need to make sure I have 1 actor (entity) per file.
Cause now, the duplicate jobs are causing file locking issues (a file is being used by another process) sort of things.

Before I move to persistent actors, I used var haveChild = Context.Child(newVideo.File.ToLower()); ...
Now, I'm using shards and entities ... I need to mimic the same functionality ...
Much Appreciated

Bartosz Sypytkowski
@Horusiath
@jalchr you can just post message to an entity - it will be created ad-hoc if it wasn't alive. Just keep in mind, that sharded entities are a bit slower and more heavyweight than normal actors (because of all automatic lifecycle and cluster message routing machanisms).
jalchr
@jalchr
@Horusiath You mean I don't have to query for the shard state to detect whether or not an entity already exists ?
And simply send a message, as long as an entity can exist only once... right ?
Bartosz Sypytkowski
@Horusiath
yes
jalchr
@jalchr
very well...
In all cases, how can we query a shard for its 'state' :) ?
jalchr
@jalchr
I'm experience "shortage" in communication ....
here is a sample log file
2017-12-09 16:03:35,998 [6] WARN  Akka.Cluster.ClusterCoreDaemon - Cluster Node [akka.tcp://ArchiveSystem@140.125.4.1:16568] - Marking node(s) as UNREACHABLE [Member(address = akka.tcp://ArchiveSystem@140.125.4.2:16668, Uid=81451205 status = Up, role=[importer-old], upNumber=21), Member(address = akka.tcp://ArchiveSystem@140.125.4.3:16666, Uid=807193699 status = Up, role=[web], upNumber=19)]. Node roles [importer,pubsub-node]
2017-12-09 16:03:36,013 [6] INFO  Akka.Cluster.ClusterCoreDaemon - Marking node(s) as REACHABLE [Member(address = akka.tcp://ArchiveSystem@140.125.4.2:16668, Uid=81451205 status = Up, role=[importer-old], upNumber=21)]. Node roles [importer,pubsub-node]
2017-12-09 16:03:36,013 [6] INFO  Archive.Shared.Cluster.ClusterStatus - UnreachableMember: Member(address = akka.tcp://ArchiveSystem@140.125.4.2:16668, Uid=81451205 status = Up, role=[importer-old], upNumber=21), Role(s): importer-old
2017-12-09 16:03:36,013 [6] INFO  Archive.Shared.Cluster.ClusterStatus - UnreachableMember: Member(address = akka.tcp://ArchiveSystem@140.125.4.3:16666, Uid=807193699 status = Up, role=[web], upNumber=19), Role(s): web
2017-12-09 16:03:36,013 [6] INFO  Akka.Cluster.ClusterCoreDaemon - Leader can currently not perform its duties, reachability status: [Reachability([akka.tcp://ArchiveSystem@140.125.4.1:16568 -> UniqueAddress: (akka.tcp://ArchiveSystem@140.125.4.2:16668, 81451205): Reachable [Reachable] (29)], [akka.tcp://ArchiveSystem@140.125.4.1:16568 -> UniqueAddress: (akka.tcp://ArchiveSystem@140.125.4.3:16666, 807193699): Unreachable [Unreachable] (28)])], member status: [$akka.tcp://ArchiveSystem@140.125.4.1:16568 $Up seen=$True, $akka.tcp://ArchiveSystem@140.125.4.1:16668 $Up seen=$False, $akka.tcp://ArchiveSystem@140.125.4.2:16568 $Up seen=$False, $akka.tcp://ArchiveSystem@140.125.4.2:16668 $Up seen=$False, $akka.tcp://ArchiveSystem@140.125.4.3:16666 $Up seen=$False, $akka.tcp://ArchiveSystem@140.125.4.4:16666 $Up seen=$False, $akka.tcp://ArchiveSystem@140.125.4.5:4053 $Up seen=$False, $akka.tcp://ArchiveSystem@140.125.4.6:4053 $Up seen=$False]
2017-12-09 16:03:36,138 [6] INFO  Archive.Shared.Cluster.ClusterStatus - ReachableMember: Member(address = akka.tcp://ArchiveSystem@140.125.4.2:16668, Uid=81451205 status = Up, role=[importer-old], upNumber=21), Role(s): importer-old
2017-12-09 16:03:36,138 [6] WARN  Archive.Shared.Cluster.ClusterStatus - Unreachable Member; Role: web, Status: Up, Address: 
2017-12-09 16:03:36,138 [6] WARN  Archive.Shared.Cluster.ClusterStatus - Unreachable Member; Role: web, Status: Up, Address: akka.tcp://ArchiveSystem@140.125.4.3:16666, 
2017-12-09 16:03:36,138 [6] WARN  Archive.Shared.Cluster.ClusterStatus - Unreachable Member; Role: web, Status: Up, Address: akka.tcp://ArchiveSystem@140.125.4.3:16666, 
2017-12-09 16:03:36,154 [6] WARN  Archive.Shared.Cluster.ClusterStatus - Unreachable Member; Role: web, Status: Up, Address: akka.tcp://ArchiveSystem@140.125.4.3:16666, 
2017-12-09 16:03:36,154 [6] WARN  Archive.Shared.Cluster.ClusterStatus - Unreachable Member; Role: web, Status: Up, Address: akka.tcp://ArchiveSystem@140.125.4.3:16666, 
2017-12-09 16:03:36,154 [6] WARN  Archive.Shared.Cluster.ClusterStatus - Unreachable Member; Role: web, Status: Up, Address: akka.tcp://ArchiveSystem@140.125.4.3:16666, 
2017-12-09 16:03:36,154 [6] WARN  Archive.Shared.Cluster.ClusterStatus - Unreachable Member; Role: web, Status: Up, Address: akka.tcp://ArchiveSystem@140.125.4.3:16666, 
2017-12-09 16:03:36,154 [6] WARN  Archive.Shared.Cluster.ClusterStatus - Unreachable Member; Role: web, Status: Up, Address: akka.tcp://ArchiveSystem@140.125.4.3:16666, 
2017-12-09 16:03:36,154 [6] WARN  Archive.Shared.Cluster.ClusterStatus - Unreachable Member; Role: web, Status: Up, Address: akka.tcp://ArchiveSystem@140.125.4.3:16666, 
2017-12-09 16:03:36,170 [6] WARN  Archive.Shared.Cluster.ClusterStatus - Unreachable Member; Role: web, Status: Up, Address:
I have more than 2 roles ... "web" which is the front-end web application and "importer" which is the video processing service.
I noticed that after few days of running ... the combination of lighthouse and other roles ... somehow cause this