The issue occurs when the list of seed nodes contains multiple occurrences of selfAddress and there are no other addresses in that list. Here is a reproducible example:
val cluster = Cluster(system)
val seedNodes = Seq(cluster.selfAddress, cluster.selfAddress)
cluster.joinSeedNodes(seedNodes)
The issue occurs when the list of seed nodes contains multiple occurrences of
selfAddress
and there are no other addresses in that list. Here is a reproducible example:The root cause of the issue is the following:
FirstSeedNodeProcess
actor to join the cluster.FirstSeedNodeProcess
we filter out all seed nodes that match theselfAddress
instance: https://github.com/akka/akka/blob/master/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala#L1418 . TheremainingSeedNodes
ends up empty.FirstSeedNodeProcess
actor never sends theInitJoin
message.Despite the minority of this issue, it may cause some unexpected behavior in case when the
seed-node-timeout
is high enough.The quick solution for this issue is to use
Set
here: https://github.com/akka/akka/blob/master/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala#L599. And if possible pass thisSet
instances into theFirstSeedNodeProcess
andJoinSeedNodeProcess
constructors.I'd be happy to submit a PR if the problem and the proposed solution make sense.