-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cluster.Tools.Client.ClusterReceptionist: An entry with the same key already exists. #2535
Comments
@cgstevens as I understand shuting down a node gets acknowledged by other nodes by calling it down? Or does it remaing unreachable waiting for reconnection to happen? It looks like either we could forgot removing an entry somewhere on downing a node event or we should use indexer setter instead of Add method on SortedDictionary. |
@Horusiath I don't have that answer as I the logs didn't say with running Info. |
I think, that I've encountered similar issue. I'm running a Akka.NET cluster on Kubernetes with Cluster Receptionist and a second application running Cluster Client. After I deploy a new version of cluster application (it's important that since we're using K8s, the nodes are started on random IP/port), the cluster receptionist happens to return contact points to old nodes that already left the cluster to the client. I've tried to reproduce the issue locally by adding some extra logging to the ClusterReceptionist code and I've found out that Receptionist is handling the MemberRemoved event correctly but ImmutableSortedSet with RingOrder comperer used beneath does not always handle removing nodes correctly. Issue reproduction:
Akka.NET version: 1.3.11 and dev branch Platform: Happens both on Windows dev environment and Docker container running on Kubernetes. |
@mwpro thanks for reporting this - we'll take a closer look at it. |
Looks like the issue is here: akka.net/src/contrib/cluster/Akka.Cluster.Tools/Client/ClusterReceptionist.cs Lines 326 to 333 in cf0cb8c
This I rewrote the method to use the following code: public int Compare(Address x, Address y)
{
var ha = HashFor(x);
var hb = HashFor(y);
if (ha == hb) return Member.AddressOrdering.Compare(x, y);
return ha.CompareTo(hb);
} The |
Just wanted to point something out:
This would have made the problem worse - the reason why there's an error in the first place inside the |
Fixed broker `IComparer` for ClusterClient hash ring and ported over other handoff fixes. Close #2535 Close #2312 Close #3840 * implemented akka/akka#24167 * implemented akka/akka#22992
Fixed broker `IComparer` for ClusterClient hash ring and ported over other handoff fixes. Close akkadotnet#2535 Close akkadotnet#2312 Close akkadotnet#3840 * implemented akka/akka#24167 * implemented akka/akka#22992
Version 1.3
After having my member .Terminate and shutdown and then come back up when it joins the cluster ALL the other members log the following error.
[akka://mysystem/system/receptionist] - An entry with the same key already exists.
System.ArgumentException: An entry with the same key already exists.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.TreeSet
1.AddIfNotPresent(T item) at System.Collections.Generic.SortedDictionary
2.Add(TKey key, TValue value)at Akka.Routing.ConsistentHash.Create[T](IEnumerable`1 nodes, Int32 virtualNodesFactor)
at Akka.Cluster.Tools.Client.ClusterReceptionist.Receive(Object message)
at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
at Akka.Actor.ActorCell.ReceiveMessage(Object message)
at Akka.Actor.ActorCell.Invoke(Envelope envelope)
The text was updated successfully, but these errors were encountered: