Skip to content

Rate limiter replaces longer quotas with shorter limits from later headers #1409

Closed

Description

@itsrayeedscodespace

How do you use Sentry?

Reproduced locally without a Sentry server, using the SDK's rate limiter.

Version

Current master (92580321), Rust 1.93.0, macOS arm64.

Steps to Reproduce

RateLimiter::update_from_sentry_header overwrites each stored deadline with the last group in the header. For example:

use sentry::transports::{RateLimiter, RateLimitingCategory};

let mut limiter = RateLimiter::new();
limiter.update_from_sentry_header("3600:error:organization, 0:error:project");
assert!(limiter.is_disabled(RateLimitingCategory::Error).is_some());

The assertion fails because the zero-second project limit replaces the still-active one-hour organization limit. Repeating this across separate header updates produces the same result. It also affects the implicit all-categories limit (3600::organization, 0::project).

The global deadline can also be shortened by a subsequent Retry-After or a headerless 429 response, since all three update methods assign instead of merging expiration times.

Expected Result

Retain the maximum deadline for each category and the all-categories limit. Sentry's transport specification explicitly requires retaining a longer stored limit when a shorter one arrives:
https://develop.sentry.dev/sdk/foundations/transport/rate-limiting/#stage-2-determine-rate-limits

Actual Result

The SDK can resume sending an affected data category before the longer quota expires. This applies to every currently recognized category. Three regression tests fail on unchanged master (duplicate header groups, separate responses, and global updates).

Proposed Fix

Keep the maximum of the stored and incoming expiry in each update path, without changing parsing or header precedence.

Activity

  1. linear-code commented on Nov 14, 2026

    @linear-code
  2. added
    Rust
    Bug
    on Nov 14, 2026
  3. added a commit that references this issue on Nov 16, 2026
    d7deae5
  4. szokeasaurusrex commented on Nov 16, 2026

    @szokeasaurusrex
    Member

    Hey @itsrayeedscodespace, thank you for the issue and the PR. This indeed looks like a real bug!

  5. added a commit that references this issue on Nov 20, 2026
    ea90839
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugRust

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions