open-nomad/helper
Tim Gross 0a19fe3b60 fix multiple overflow errors in exponential backoff (#18200)
We use capped exponential backoff in several places in the code when handling
failures. The code we've copy-and-pasted all over has a check to see if the
backoff is greater than the limit, but this check happens after the bitshift and
we always increment the number of attempts. This causes an overflow with a
fairly small number of failures (ex. at one place I tested it occurs after only
24 iterations), resulting in a negative backoff which then never recovers. The
backoff becomes a tight loop consuming resources and/or DoS'ing a Nomad RPC
handler or an external API such as Vault. Note this doesn't occur in places
where we cap the number of iterations so the loop breaks (usually to return an
error), so long as the number of iterations is reasonable.

Introduce a helper with a check on the cap before the bitshift to avoid overflow in all 
places this can occur.

Fixes: #18199
Co-authored-by: stswidwinski <stan.swidwinski@gmail.com>
2023-08-15 14:39:09 -04:00
..
args
boltdd
broker test: fix flakey broker notifier test. (#16994) 2023-05-10 13:40:25 +01:00
bufconndialer
codec
constraints/semver
crypto
discover
envoy connect: remove unusable path for fallback envoy image names (#17044) 2023-05-02 09:48:44 -05:00
escapingfs
escapingio
flags
flatmap
gated-writer
grpc-middleware/logging
ipaddr
iterator node pools: apply node pool scheduler configuration (#17598) 2023-06-21 20:31:50 -04:00
logging
mount
noxssrw
pluginutils
pointer
pool
raftutil node pool: initial base work (#17163) 2023-05-15 10:49:08 -04:00
snapshot
stats backport of commit 615e76ef3c23497f768ebd175f0c624d32aeece8 (#17993) 2023-07-19 13:31:14 -05:00
subproc
testlog
testtask
tlsutil backport of commit 8cabda5ec5c1d0dd3290ece4789cd8fea1ca3f5c (#18043) 2023-07-24 04:44:15 -05:00
useragent
users
uuid
winsvc
backoff.go fix multiple overflow errors in exponential backoff (#18200) 2023-08-15 14:39:09 -04:00
backoff_test.go fix multiple overflow errors in exponential backoff (#18200) 2023-08-15 14:39:09 -04:00
cluster.go
cluster_test.go update go1.21 (#18184) 2023-08-15 14:40:33 +02:00
eof.go
funcs.go update go1.21 (#18184) 2023-08-15 14:40:33 +02:00
funcs_test.go update go1.21 (#18184) 2023-08-15 14:40:33 +02:00
opaque.go
opaque_test.go
warning.go
warning_test.go