etcd-io / raft

Raft library for maintaining a replicated state machine
Apache License 2.0
666 stars 164 forks source link

tracker: fix byte counter leak in Inflights tracker #54

Closed pav-kv closed 1 year ago

pav-kv commented 1 year ago

This change fixes a bug in the Inflights tracker. The reset() method did not zero the bytes counter, which could result in a quota "leak" and delayed or stalled MsgApp sends.

The reset() method is used when the replication flow changes state between Probe/Replicate/Snapshot. If reset() is not called at an appropriate moment, when Inflights.Full(), the bytes counter would stay over the budget and stall the flow.

The test added in this PR failed before, and passes after the change.

pav-kv commented 1 year ago

@ahrtr FYI, this bug shouldn't affect etcd (I assume you don't yet use the MaxInflightBytes option).

ahrtr commented 1 year ago

@ahrtr FYI, this bug shouldn't affect etcd (I assume you don't yet use the MaxInflightBytes option).

No, etcd doesn't use it at all.