Commit 7fac93b
lease: reject KeepAlive during lease revocation
When a lease expires, the leader revokes it by deleting attached keys
and then removing the lease from leaseMap. A concurrent KeepAlive
(Renew) request can race in between these two steps: it finds the
lease still in leaseMap and successfully renews it, returning a
positive TTL to the client while the keys are already gone.
Fix this by closing lease.revokec at the start of Revoke() before
releasing the lock to delete keys, and checking lease.revokec in
Renew() after acquiring the lock. If revokec is closed, Renew()
returns ErrLeaseNotFound, ensuring the client is not misled into
thinking the lease (and its keys) are still alive.
Signed-off-by: Yishuai Li <yishuai.li@pingcap.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 8df0f35 commit 7fac93b
1 file changed
+9
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
451 | 459 | | |
452 | 460 | | |
453 | 461 | | |
| |||
0 commit comments