A shard can fail to send replication heads after an expiry event and a brief not-ready state
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 12/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- elixir
- Domain
- distributed-systems
Research direction
The sequence centres on Group.connect/2, expire_replica_peer, send_replica_heads, and the peer_connect, peer_connect_ack and replica_cluster_open handlers, with route_ready? and epoch deduplication deciding whether heads get resent. Start by reading the TLA+ model the reporter cites next to the readiness check in the code, since their mismatch is the root cause. Done means a repeated peer_connect at the same epoch after a not-ready ack still causes heads to be sent, which needs maintainer agreement on the intended protocol first.
Written by the indexing model from the issue text.
Description
Hello, this is the second issue I identified while experimenting with DST on the Group repo. This one is more involved than #32 , and I was only able to get to about 80% understanding myself. I hope the maintainers find it useful rather than noise.
Description
The summary of the issue is that a shard can fail to send its replication heads after an expiry event and a brief not-ready state. One trigger is a well-timed call to Group.connect/2.
We have a cluster with a, b, and c nodes and multiple shards configured.
Consider this sequence of events:
- A
cshard-0 (c0) is sending heartbeat messages to the corresponding shardb0, but each one remains undelivered. For example, these can be dropped when the dist port is busy as a result of the:nosuspendon the send. b0invokesexpire_replica_peerafter a series of missed heartbeats.b0's belief ofc0data is wiped locally, including the replication cursors forc’s streams and the entry inremote_shards.b0begins rediscovery, which includes newpeer_connectmessages. It bumps its probe epoch forc0toN.c0still holds the same info it had previous. Namely,c0has no pending heads forb, since each was acked until this point.- On
b, we executeGroup.connect(:my_app, "blue"). The revision is bumped toR+1. b0's anti-entropy timer puts the message on theb0mailbox.bputs:cluster_connecton theb0mailbox.b0handles the anti-entropy message, sends apeer_connecttoc0with probe epochN. The revision, read from ets, isR+1.b0handles the:cluster_connect, sendsreplica_cluster_opentoc0, revisionR+1.c0handles thepeer_connectprobe. It has only seen revisionR, soroute_ready?is false.c0records epochNas seen, and acks withpeer_connect_ack(N, false). Because the probe is not ready,c0does not callsend_replica_heads.c0handles thereplica_cluster_open. At this point, a future peer_connect request on a new epoch would be responded to with "ready", and would also resend heads. However, we'll see that apeer_connectwith the same epochNwill not.b0receives the "not-ready" ack and at some future time the process sends anotherpeer_connect, still with epochN.c0receives thepeer_connectat epochN, decides epochNhas already been seen (:duplicate) and acks withpeer_connect_ack(N, true). No heads are sent.b0receives and stops probing. Nothing will ever sendc0’s heads tob0again.
In the TLA+ model, there is a mismatch between what the model describes and what the code implements. The code has an extra readiness check that exposes the bug.
Testing performed on main at 08b5a5.
DST details
Config:
- Injected faults: heartbeats dropped with probability 0.7
- 6 of 600 seeds failed in the sweep. 1 of those 6 is the seqeunce described above. The others appear to have a similar pattern
Code:
- In order to instrument Group for DST with eta, I've had to make changes locally. The changes are focused on allowing Group to run multiple nodes within the same VM. The code is in my fork here.
- Details about the issue were confirmed on unmodified main outside of DST, but not a full runtime reproduction.
- Dominant language
- Elixir
- Stars
- 47
- Forks
- 2
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from phoenixframework/group
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
phoenixframework/group#32 ·
All issues in phoenixframework/group
Similar issues
-
Bug: Table layout and date column are cut off on mobile screens on the Tournaments -> History pageOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
hexlet-codebattle/codebattle#2375 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Broadcast API docs say to prepend realtime: to the topic, which breaks deliveryPossibly taken @mandar1045 claimed this 1 day ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
phoenixframework/phoenix_live_view#4509 ·
Maintainers usually reply within 1 day
-
camelToSnake and snakeCamelMapper() drop the underscore when a digit precedes a camelCase boundaryOpen
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
electric-sql/electric#4855 ·