Skip to content

Commit bedd8b5

Browse files
committed
Fix replication queue full-detection to actually detect fullness
BoundedChannelFullMode.DropWrite makes TryWrite report success (and silently discard the item) even when the channel is full, so the "queue full -> report member unavailable" branch in Replicate() never fired and the dropped barrier slot was never resolved, leaking that ReplicationBarrier instance out of the pool. Wait gives TryWrite the false-when-full return value the code already assumed.
1 parent ac27d5a commit bedd8b5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/ReplicationUtils/ReplicationProcess.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ public ReplicationProcess(TMember member, int queueSize)
4444

4545
var channel = Channel.CreateBounded<ReplicationBarrier>(new BoundedChannelOptions(queueSize)
4646
{
47-
FullMode = BoundedChannelFullMode.DropWrite,
47+
// DropWrite makes TryWrite report success (silently discarding the item) even when full;
48+
// Replicate() below relies on a false return to synchronously report the member as
49+
// unavailable for this round, which only Wait actually provides.
50+
FullMode = BoundedChannelFullMode.Wait,
4851
AllowSynchronousContinuations = false,
4952
SingleReader = true,
5053
SingleWriter = true,

0 commit comments

Comments
 (0)