Skip to content

fix: avoid zero-rate queue reader throttling#9619

Open
mykaul wants to merge 1 commit intotemporalio:mainfrom
mykaul:fix/zero-rate-queue-reader-throttling
Open

fix: avoid zero-rate queue reader throttling#9619
mykaul wants to merge 1 commit intotemporalio:mainfrom
mykaul:fix/zero-rate-queue-reader-throttling

Conversation

@mykaul
Copy link
Copy Markdown
Contributor

@mykaul mykaul commented Mar 23, 2026

Summary

  • When persistenceMaxQPS is set to 0 (meaning "unlimited"), the queue reader rate limiter receives a zero rate, causing all queue readers to fail with "burst size is smaller than required token count" and never process tasks.
  • This fixes the rate function to return a high default (100,000) when persistence QPS is unlimited, and adds a missing return after the error log to prevent falling through to an invalid lock/read path.

Bug Details

NewHostRateLimiterRateFn computes float64(persistenceMaxRPS()) * persistenceMaxRPSRatio. When persistenceMaxRPS() returns 0 (unlimited), this produces rate=0, which creates a rate limiter with burst=0. The reader then cannot acquire even 1 token, logging the error but continuing into r.Lock() without tasks — effectively a tight error loop.

Testing

  • Verified with benchmarks that queue readers function correctly with persistenceMaxQPS: 0 in dynamic config.
  • Existing unit tests pass.

@mykaul mykaul requested review from a team as code owners March 23, 2026 07:56
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.

1 participant