Skip to content

Retry with exponential backoff result in time to wait of zero #7173

@flaviolemos78

Description

@flaviolemos78

If you are trying to resolve an environment-specific issue or have a one-off question about the edge case that does not require a feature then please consider asking a question in argocd slack channel.

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

When using self-real with exponential backoff retries, there will be a time where the time to wait for the next retry will be zero, causing the retry to happen immediately.

This happens during the NextRetryAt function calculations:

timeToWait := duration * time.Duration(math.Pow(float64(factor), float64(retryCounts)))

for example, for a factor of 2 and a retryCount of 80, the result of math.Pow(float64(factor), float64(retryCounts)) is 1208925819614629200000000 (float64), that when casted to time.Duration (int64) will overflow and the result will be -9223372036854775808, that when multiplied by duration (e.g 5000000000) will result in zero.

To Reproduce

  1. Create an Application with the following syncPolicy:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: example-app
  namespace: argocd
spec:
  destination:
    ...
  project: default
  source:
    ...
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    retry:
      backoff:
        maxDuration: 1m
      limit: -1
  1. Ensure that the app sync will fail so that the retry can kick in, e.g, configure the destination namespace to a non existent one

Expected behavior

When the time to wait is greater than the max duration, max duration will be used to wait between retries

Screenshots

If applicable, add screenshots to help explain your problem.

Version

argocd: v2.0.1+33eaf11
  BuildDate: 2021-04-15T22:36:03Z
  GitCommit: 33eaf11e3abd8c761c726e815cbb4b6af7dcb030
  GitTreeState: clean
  GoVersion: go1.16
  Compiler: gc
  Platform: windows/amd64
time="2021-09-07T15:33:56+01:00" level=fatal msg="Argo CD server address unspecified"

Logs
There's no error logs related

Metadata

Metadata

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions