Repository navigation
fix(transport): Keep the longest active rate limit - #8297
Open
sentry-junior[bot] wants to merge 1 commit into
Open
sentry-junior[bot] wants to merge 1 commit into
sentry-junior[bot] wants to merge 1 commit into
Conversation
A shorter rate limit replaced a longer one that was still active, both for repeated categories in one X-Sentry-Rate-Limits header and across responses, including the all-categories limit set by a 429. The SDK then sent that category before the longer quota expired. The deadlines are now stored in a private _RateLimits class. Its only write operation, update, keeps the later of the stored and the new deadline, so no update path can shorten an active limit. The backing dict is name-mangled and the class uses __slots__. Fixes #8296 Co-Authored-By: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
Contributor
Coverage Results 📊✅ 139245 passed | ⏭️ 7857 skipped | Total: 147102 | Pass Rate: 94.66% | Execution Time: 436m 10s 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 85.71% (18 of 21 changed executable lines covered; target 80%). Changed files with executable lines (1)
Coverage diff@@ Coverage Diff @@
## master #8297 +/-##
==========================================
- Coverage 90.23% 90.22% -0.01%
==========================================
Files 203 203 —
Tracked lines 27335 27348 +13
Branches 10246 10250 +4
==========================================
+ Hits 24663 24672 +9
- Misses 2672 2676 +4
- Partials 1556 1558 +2Generated by Coverage Action |
Collaborator
|
Closing because we're not prioritizing merging this right now. |
Contributor
PR risk: mediumFor commit Main concerns: reach, host performance. This label is a hint for reviewers, not an approval. |
Member
Reopening this, as it is not good that the SDK does not respect rate limits, and imo we should prioritize getting a fix in. cc @alexander-alderman-webb @sentrivana |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A shorter rate limit replaced a longer one that was still active, so the SDK resumed sending before the quota expired. For example, after
X-Sentry-Rate-Limits: 3600:error:organization, 0:error:project, errors were sent immediately instead of being held for an hour. Sentry rejects those events anyway, so the SDK spends requests on data that is dropped. The spec requires keeping the longer limit.The deadlines now live in a private
_RateLimitsclass whose only write method keeps the later deadline, so no update path (header,Retry-After, 429) can shorten an active limit.This is the same bug as getsentry/sentry-rust#1409, reported by @itsrayeedscodespace, and the same fix as getsentry/sentry-rust#1410.
Closes #8296
via @szokeasaurusrex.
--
View Session [Sentry]