Repository navigation
fix(gateway): tighten renew and rotation lock release - #1599
Merged
Merged
Conversation
kvinwang
force-pushed
the
fix/gateway-lock-identity
branch
from
November 18, 2026 08:06
f0986cf to
df99dbc
Compare
release_lock could delete a successor's lease. A delete is stamped with local wall time and wins LWW over any lock stamped earlier: - The value (started_at seconds, started_by) is not unique: after a force release the same node can re-acquire in the same second, and the stale holder's release matched and deleted the successor's lock. Add a random nonce to the value. - An absent key (already released or force-released) also fell through to the delete, which could beat a successor's lock not yet received. Delete only when the current value is ours. - A holder past its timeout could delete a lease a peer had already taken over unseen. A peer takes over only once its clock reads started_at + timeout, stamping its lock no earlier, so a delete before the holder's clock reaches that point cannot beat it whatever the skew. Past it, leave the lease to expire; release now takes the timeout, like acquire. The nonce is a serde-default field of a map-encoded value, so older gateways ignore it and older records decode with nonce 0; the legacy fixture now encodes the real two-field shape. Signed-off-by: Kevin Wang <wy721@qq.com>
kvinwang
force-pushed
the
fix/gateway-lock-identity
branch
from
November 18, 2026 08:27
df99dbc to
50994ea
Compare
kvinwang
enabled auto-merge
November 18, 2026 08:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
release_lockcould delete a successor's lease. A delete is stamped with local wall time and wins LWW over any lock stamped earlier:(started_at seconds, started_by)is not unique; after a force release the same node can re-acquire in the same second and the stale holder's release matches. Adds a randomnoncetoCertRenewLock.started_at + timeout, so a delete before the holder's clock reaches that point cannot beat the takeover, whatever the skew; past it the lease is now left to expire.release_*_locktakes the timeout, like acquire.Compatibility: values are msgpack maps and
nonceis#[serde(default)], so older gateways ignore it and older records decode withnonce = 0(the legacy fixture now encodes the real two-field shape). Cross-node exclusion stays best-effort (no CAS in WaveKV).Found by the Lean model of the lock (#1597,
CertLock.lean).