0a19fe3b60
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> |
||
---|---|---|
.. | ||
indexer | ||
paginator | ||
autopilot.go | ||
autopilot_test.go | ||
deployment_events_test.go | ||
events.go | ||
events_test.go | ||
iterator.go | ||
schema.go | ||
schema_test.go | ||
state_changes.go | ||
state_store.go | ||
state_store_acl.go | ||
state_store_acl_binding_rule.go | ||
state_store_acl_binding_rule_test.go | ||
state_store_acl_sso.go | ||
state_store_acl_sso_test.go | ||
state_store_acl_test.go | ||
state_store_node_pools.go | ||
state_store_node_pools_test.go | ||
state_store_oss.go | ||
state_store_restore.go | ||
state_store_restore_test.go | ||
state_store_service_regisration_test.go | ||
state_store_service_registration.go | ||
state_store_test.go | ||
state_store_variables.go | ||
state_store_variables_oss.go | ||
state_store_variables_test.go | ||
testing.go |