Commit a50c8cc
antengye
fix(discov): prevent etcd key leak when Watch DELETE races with lease expiry
The publisher's Watch-based self-healing (added after v1.8) re-puts
the key with p.lease whenever a DELETE event is observed. When the
DELETE is caused by lease expiry and races with the KeepAlive channel
close, the publisher may Put with an expired or zero LeaseID, which
makes the key permanent in etcd (no TTL) and leaks forever.
This fix adds a TimeToLive check before re-putting: if the lease is
already expired or gone, the publisher skips the Put and immediately
restarts the keepalive flow instead, avoiding orphaned keys.1 parent 22bdae0 commit a50c8cc
3 files changed
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
154 | 172 | | |
155 | 173 | | |
156 | 174 | | |
| |||
0 commit comments