Skip to content

Conversation

@kishorekg1999
Copy link
Contributor

@kishorekg1999 kishorekg1999 commented Jan 6, 2026

What this PR does:
This PR fixes a critical deadlock in the query scheduler that occurs when a tenant's max_outstanding_requests_per_tenant limit is dynamically reduced via runtime configuration.

When MaxOutstandingPerTenant is reduced while a user's FIFORequestQueue is full, the getOrAddQueue method attempts to migrate requests to a smaller queue. Previously, this loop blocked indefinitely when the new queue capacity was reached, causing the scheduler to freeze.

The fix ensures the migration loop breaks when the new queue is full, effectively dropping excess requests instead of blocking.

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

…urs when a tenant's max_outstanding_requests_per_tenant limit is dynamically reduced via runtime configuration.

When MaxOutstandingPerTenant is reduced while a user's FIFORequestQueue is full, the getOrAddQueue method attempts to migrate requests to a smaller queue. Previously, this loop blocked indefinitely when the new queue capacity was reached, causing the scheduler to freeze.

The fix ensures the migration loop breaks when the new queue is full, effectively dropping excess requests instead of blocking.

Signed-off-by: Kishore K G <[email protected]>
Signed-off-by: Kishore K G <[email protected]>
@dosubot dosubot bot added the type/bug label Jan 6, 2026
@kishorekg1999 kishorekg1999 changed the title Fix scheduler deadlock when reducing max_outstanding_requests_per_tenant fix: fix scheduler deadlock when reducing max_outstanding_requests_per_tenant Jan 7, 2026
Signed-off-by: Kishore K G <[email protected]>
@kishorekg1999
Copy link
Contributor Author

@SungJin1212 can you please review this PR when you get a chance ?


// flush to new queue
for uq.queue.length() > 0 {
for (uq.queue.length() > 0) && (tmpQueue.length() < maxOutstanding) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add some comment to this line?
like

Suggested change
for (uq.queue.length() > 0) && (tmpQueue.length() < maxOutstanding) {
// If the new limit is lower than the current number of requests,
// the excess requests (newest ones) will be dropped to prevent deadlocks.
for (uq.queue.length() > 0) && (tmpQueue.length() < maxOutstanding) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Copy link
Member

@SungJin1212 SungJin1212 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me, I left one comment. Thanks for contribution!

@SungJin1212
Copy link
Member

@kishorekg1999
Can you add a changelog?

Signed-off-by: Kishore K G <[email protected]>
@kishorekg1999
Copy link
Contributor Author

Thanks for the quick response @SungJin1212 ! I've incorporated the comments.

Signed-off-by: Kishore K G <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants