Skip to content

System.Threading.RateLimiting.ChainedRateLimiter #125560

Closed

Description

@lobster2012-user

Description

Hello!
I found a few bugs in the class System.Threading.RateLimiting.ChainedRateLimiter

  1. Implemenration of IdleDuration

If at least one IdleDuration object is non-null, a non-null value will be returned always. This will clear the entire chain in DefaultPartitionedRateLimiter.Heartbeat. Even if there are active limiters with nullable idleDuration.

public override TimeSpan? IdleDuration
        {
            get
            {
                ThrowIfDisposed();

                TimeSpan? lowestIdleDuration = null;

                foreach (RateLimiter limiter in _limiters)
                {
                    if (limiter.IdleDuration is { } idleDuration)
                    {
                        if (lowestIdleDuration is null || idleDuration < lowestIdleDuration)
                        {
                            lowestIdleDuration = idleDuration;
                        }
                    }
                }

                return lowestIdleDuration;
            }
        }
  1. ChainedRateLimiter not implements ReplenishingRateLimiter
    Because of this, the TryReplenish method will not be called for the chain of child objects.
    See DefaultPartitionedRateLimiter.Heartbeat

Reproduction Steps

I tried to use this class and caught the described bugs.

Expected behavior

Code without bugs

Actual behavior

Code without bugs

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Activity

  1. added
    untriaged
    on Mar 14, 2026
  2. added
    area-CodeGen-coreclr
    on Mar 14, 2026
  3. dotnet-policy-service commented on Mar 14, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
    See info in area-owners.md if you want to be subscribed.

  4. changed the title [-]ChainedRateLimiter[/-] [+]System.Threading.RateLimiting.ChainedRateLimiter[/+] on Mar 14, 2026
  5. added and removed
    area-CodeGen-coreclr
    on Mar 14, 2026
  6. dotnet-policy-service commented on Mar 14, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @VSadov
    See info in area-owners.md if you want to be subscribed.

  7. self-assigned this
    on Mar 26, 2026
  8. removed
    untriaged
    on Apr 10, 2026
  9. added a commit that references this issue on Apr 10, 2026
    c6d701a
  10. locked and limited conversation to collaborators on May 11, 2026
  11. added a commit that references this issue on Jul 15, 2026
    1ca85ba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions