Commit a78cc52
committed
fix(dns): check for negative_ttl of zero
see linkerd/linkerd2#14954.
some user reports describe situations in which, when the linkerd control
plane's destination controller is OOM-killed, DNS resolution can
momentarily cause the proxy to compute a negative-TTL duration of zero.
this causes a panic in production environments, because
`tokio::time::interval` asserts that it has not been provided a duration
of zero.
this manifests in errors that look like this:
```
thread 'main' panicked at linkerd/app/core/src/control.rs:118:49: period must be non-zero.
```
this commit patches `linkerd-dns::ResolveError::negative_ttl()` so that
it will now log a warning and instead return `None` when a negative TTL
of zero is encountered. a shared `duration_from_error()` helper
(bikeshedding welcome) helps do this for both A/AAAA and SRV records.
X-Ref: #3807
Signed-off-by: katelyn martin <kate@buoyant.io>1 parent afb7b79 commit a78cc52
1 file changed
+33
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
205 | | - | |
| 204 | + | |
206 | 205 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
217 | 214 | | |
218 | 215 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
227 | 239 | | |
228 | 240 | | |
229 | | - | |
| 241 | + | |
230 | 242 | | |
231 | 243 | | |
232 | 244 | | |
| |||
0 commit comments