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 exponential backoff delay overflowing the maximum delay in setTimeout, causing a high number of requests and errors #441

Merged
merged 4 commits into from
Mar 21, 2022

Conversation

leolabs
Copy link
Contributor

@leolabs leolabs commented Mar 21, 2022

The setTimeout function has an interesting implementation detail where, if the delay is bigger than the biggest signed 32-bit integer, it will throw an error and run the callback after 1ms.

The error looks something like this:

TimeoutOverflowWarning: Infinity does not fit into a 32-bit signed integer.
Timeout duration was set to 1.

Since this error is also reported to Sentry by default, this causes a huge number of errors which can block the main thread.

My workaround for this is to limit the delay to 2,000,000,000 ms so it never overflows.

@leolabs leolabs changed the title Fix exponential backoff delay overflowing the maximum delay in setTimeout Fix exponential backoff delay overflowing the maximum delay in setTimeout, causing a high number of requests and errors Mar 21, 2022
@timfish
Copy link
Collaborator

timfish commented Mar 21, 2022

Thanks for the PR.

Can you fix the linting error (yarn fix) and add a line for this change to CHANGELOG.md under the 3.0.5 heading?

I'll include this fix in the release going out today!

@leolabs
Copy link
Contributor Author

leolabs commented Mar 21, 2022

Thanks for the quick reply! I've made the changes :)

@timfish timfish merged commit 8b5073f into getsentry:master Mar 21, 2022
@timfish
Copy link
Collaborator

timfish commented Mar 21, 2022

Thanks again for the PR.

Subscribe to this issue to get notified of the release.

@leolabs leolabs deleted the patch-1 branch March 21, 2022 16:17
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