Open balena opened 4 years ago
I was able to reproduce the problem as follows:
> {lclock, rclock} = Clock.seed() |> Clock.fork()
> {lclock1, rclock1} = Clock.fork(lclock)
> Clock.join(lclock, rclock1)
** (FunctionClauseError) no function clause matching in Swarm.IntervalTreeClock.sum/2
The following arguments were given to Swarm.IntervalTreeClock.sum/2:
# 1
1
# 2
{0, 1}
Attempted function clauses (showing 3 out of 3):
defp sum(0, x)
defp sum(x, 0)
defp sum({l1, r1}, {l2, r2})
lib/swarm/tracker/crdt.ex:140: Swarm.IntervalTreeClock.sum/2
lib/swarm/tracker/crdt.ex:142: Swarm.IntervalTreeClock.sum/2
lib/swarm/tracker/crdt.ex:29: Swarm.IntervalTreeClock.join/2
As I understand, you cannot join clocks of different "generations".
I'm using
Swarm
in a big cluster and I'm always getting the following error in exactly one node:Basically it is attempting to join two interval tree clocks
1
and{0, 1}
, which, apparently by definition, is undefined. The ITC1
is coming from the%TrackerState
which holds aclock
with this value1
.Either the ITC is missing a definition for this case or the
Swarm
code is saving1
in%TrackerState.clock
in a wrong way.