Skip to content

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
@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.

3 participants