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

fix: guard against overflow in sse backoff calculation #455

Merged
merged 11 commits into from
Oct 8, 2024

Conversation

cwaldren-ld
Copy link
Contributor

@cwaldren-ld cwaldren-ld commented Oct 8, 2024

In some platform configurations, the SSE backoff calculation overflows which results in failing to schedule another backoff attempt via asio::deadline_timer::expires_from_now.

This PR refactors the backoff algorithm to use free functions which can be independently tested.

It fixes the bug by constraining the maximum backoff exponent based on the configurable max backoff parameter.

Finally, I've added some test vectors for large attempt values. In the bug report, the overflow happens at about 34 minutes which corresponded to 55 attempts.

@cwaldren-ld cwaldren-ld marked this pull request as ready for review October 8, 2024 21:41
@cwaldren-ld cwaldren-ld requested a review from a team as a code owner October 8, 2024 21:41
@cwaldren-ld cwaldren-ld merged commit a3c1e58 into main Oct 8, 2024
23 checks passed
@cwaldren-ld cwaldren-ld deleted the cw/sdk-757-backoff-overflow branch October 8, 2024 23:55
@github-actions github-actions bot mentioned this pull request Oct 8, 2024
cwaldren-ld pushed a commit that referenced this pull request Oct 9, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>launchdarkly-cpp-client: 3.7.1</summary>

##
[3.7.1](launchdarkly-cpp-client-v3.7.0...launchdarkly-cpp-client-v3.7.1)
(2024-10-08)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-sse-client bumped from 0.5.3 to 0.5.4
</details>

<details><summary>launchdarkly-cpp-server: 3.6.2</summary>

##
[3.6.2](launchdarkly-cpp-server-v3.6.1...launchdarkly-cpp-server-v3.6.2)
(2024-10-08)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-sse-client bumped from 0.5.3 to 0.5.4
</details>

<details><summary>launchdarkly-cpp-server-redis-source: 2.1.14</summary>

##
[2.1.14](launchdarkly-cpp-server-redis-source-v2.1.13...launchdarkly-cpp-server-redis-source-v2.1.14)
(2024-10-08)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-server bumped from 3.6.1 to 3.6.2
</details>

<details><summary>launchdarkly-cpp-sse-client: 0.5.4</summary>

##
[0.5.4](launchdarkly-cpp-sse-client-v0.5.3...launchdarkly-cpp-sse-client-v0.5.4)
(2024-10-08)


### Bug Fixes

* guard against overflow in sse backoff calculation
([#455](#455))
([a3c1e58](a3c1e58))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants