Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect exponential backoff algorithm in RetryConfigFromDeliverySpec() #4113

Closed
travis-minke-sap opened this issue Sep 24, 2020 · 1 comment · Fixed by #4115
Closed

Incorrect exponential backoff algorithm in RetryConfigFromDeliverySpec() #4113

travis-minke-sap opened this issue Sep 24, 2020 · 1 comment · Fixed by #4115
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@travis-minke-sap
Copy link
Contributor

Describe the bug
The default exponential backoff algorithm defined in RetryConfigFromDeliverySpec() is incorrect and does not implement the advertised calculation from DeliverySpec.BackoffDelay. Instead of implementing backoffDelay*2^<numberOfRetries> as advertised, it is coded as (backoffDelay*2)^<numberOfRetries>.

Not only does this not operate as expected, but results in negative Durations due to the fact that time.Duration is stored in nanoseconds, and raising such large numbers to exponential powers quickly exceeds the int64 size of time.Duration, causing a roll-over to negative values.

Expected behavior
The algorithm should be implemented as documented and not roll-over to negative time.Duration values.

To Reproduce
Create a Subscription which specifies the following spec.delivery...

spec:
  delivery:
    backoffDelay: PT2S
    backoffPolicy: exponential
    retry: 5

...and attempt to send events to a channel which utilizes RetryConfigFromDeliverySpec() and DispatchMessageWithRetries().

Knative release version
v0.17.4

@travis-minke-sap travis-minke-sap added the kind/bug Categorizes issue or PR as related to a bug. label Sep 24, 2020
@travis-minke-sap
Copy link
Contributor Author

/assign @travis-minke-sap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant