Skip to content

client, pkg: handle canceled contexts in select paths#10930

Open
rleungx wants to merge 6 commits into
tikv:masterfrom
rleungx:fix-select-cancel-races
Open

client, pkg: handle canceled contexts in select paths#10930
rleungx wants to merge 6 commits into
tikv:masterfrom
rleungx:fix-select-cancel-races

Conversation

@rleungx

@rleungx rleungx commented Jun 23, 2026

Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number: Close #10929

What is changed and how does it work?

This PR makes internal select paths handle canceled contexts before consuming work or starting shared operations.

It prevents canceled calls from starting OrderedSingleFlight executions, collecting batch requests, acquiring concurrency limiter tokens, or registering deadline watchers. It also makes cleanup paths finish collected router requests and return resource manager token requests when dispatcher cancellation wins a select race.

Check List

Tests

  • Unit test

Release note

Fix possible leaked or unnecessary internal work when context cancellation races with client batching and singleflight paths.

Summary by CodeRabbit

  • Bug Fixes

    • Improved cancellation/timeout handling across request batching (now finalizes collected requests on cancellation), deadline watching, token bucket acquisition, concurrency limiting, ordered single-flight, concurrent runner execution, and service discovery.
    • Operations now return promptly for already-canceled contexts, avoid unnecessary enqueueing/connection creation, correctly propagate server errors to waiting calls, and ensure tokens/waiters are released or completed consistently.
  • Tests

    • Added coverage for canceled-context scenarios in batching finalization, token enqueueing, limiter/runner release semantics, ordered single-flight non-execution, and service discovery connection avoidance.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-triage-completed dco-signoff: yes Indicates the PR's author has signed the dco. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jun 23, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign okjiang for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds explicit ctx.Err() checks across multiple select-based code paths to prevent work from being consumed when a context is already canceled, and refactors ConcurrencyLimiter from token-object queuing to wake-up signals. Affected components include ConcurrencyLimiter.AcquireToken, ConcurrentRunner.run, OrderedSingleFlight.Do, batch controller collection loops, Watcher.Start, the resource manager token dispatcher, getClusterInfo/getMembers, and the router request dispatcher.

Changes

Canceled-context hardening across select-based paths

Layer / File(s) Summary
ConcurrencyLimiter wake-up refactor and cancellation hardening
pkg/ratelimit/concurrency_limiter.go, pkg/ratelimit/concurrency_limiter_test.go, pkg/ratelimit/runner.go, pkg/ratelimit/runner_test.go
ConcurrencyLimiter.queue changes from chan *TaskToken to chan struct{} wake-up signals. AcquireToken adds pre-lock and post-lock ctx.Err() guards and re-checks after receiving wake signals instead of consuming token objects. ReleaseToken sends non-blocking wake-up signals instead of token objects. ConcurrentRunner.run changes from explicit post-task release to deferred ReleaseToken (removing the tied processPendingTasks call). Four new tests assert nil token and zero counters on canceled context, verify token lifecycle on concurrent acquire/release/cancellation scenarios, and confirm stale tokens are not reused.
OrderedSingleFlight early cancellation guards
pkg/utils/syncutil/ordered_single_flight.go, pkg/utils/syncutil/ordered_single_flight_test.go
Do gains three ctx.Err() checkpoints: at entry, after currentTask assignment (invoking cancelOne), and after acquiring the execution token (returning it before starting work). The ctx.Done return path is simplified to zero, ctx.Err(). New test asserts zero executions and context.Canceled on a pre-canceled context.
Batch controller collection loop cancellation
client/pkg/batch/batch_controller.go, client/pkg/batch/batch_controller_test.go
FetchPendingRequests and FetchRequestsWithTimer add ctx.Err() checks at loop entry, after token acquisition, after each pushRequest, and after timer expiry across all collection phases. Consistent errRet returns on cancellation. New tests verify context.Canceled return, zero collectedRequestCount, no finisher invocation, and correct channel lengths under immediately-canceled contexts.
Router and resource manager dispatcher cancellation
client/clients/router/client.go, client/resource_manager_client.go, client/resource_manager_client_test.go
Router dispatcher calls FinishCollectedRequests with ctx.Err() before returning on cancellation. Resource manager dispatcher checks dispatcherCtx.Err() and firstRequest.requestCtx.Err() after dequeuing to propagate errors before stream handling; processTokenRequests notifies the requester when the gRPC response contains an error. New tests verify pre-canceled contexts are not enqueued and server errors are propagated to callers.
Deadline watcher early cancellation
client/pkg/deadline/watcher.go
Watcher.Start replaces select/default pattern with explicit ctx.Err() checks and adds a post-enqueue re-check that closes d.done if either context is canceled after deadline is queued, preventing deadline registration under already-canceled conditions.
Service discovery cancellation with early metric recording
client/servicediscovery/service_discovery.go, client/servicediscovery/service_discovery_test.go
getClusterInfo and getMembers add early ctx.Err() guards before gRPC connection acquisition, recording failed-duration metrics and returning wrapped errors without connection details; a second ctx.Err() check after connection acquisition records metrics and includes connection state in attachment errors. New test verifies pre-canceled contexts do not create gRPC connections.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Suggested labels

release-note-none

Suggested reviewers

  • okJiang
  • JmPotato
  • bufferflies
  • ystaticy

Poem

🐇 A bunny once watched channels race,
Where canceled ops still ran in place.
Now ctx.Err() guards each gate,
Wake-up signals, fresh tokens create!
No ghost work, no dangling threads in flight —
The warren's select-paths sleep soundly tonight. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.25% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: handling canceled contexts in select paths across client and package code.
Description check ✅ Passed The description includes the issue number, a clear commit message explaining the changes, identifies it as a unit test change, and provides an appropriate release note.
Linked Issues check ✅ Passed The PR directly addresses all requirements from issue #10929: preventing canceled contexts from consuming work in OrderedSingleFlight, batch collection, concurrency limiting, deadline watching, and dispatcher paths with proper cleanup.
Out of Scope Changes check ✅ Passed All changes are directly related to handling canceled contexts in select-based paths as specified in issue #10929; no out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ti-chi-bot ti-chi-bot Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client/servicediscovery/service_discovery.go`:
- Around line 933-937: The context cancellation guard using ctx.Err() is being
checked too late in both RPC helper functions. The ctx.Err() check in the
function containing GetOrCreateGRPCConn and the similar check around line 974
need to be moved to execute before the connection is acquired, not after.
Restructure both functions to check if the context is already canceled (using
ctx.Err()) at the beginning, before calling GetOrCreateGRPCConn, so that
canceled contexts exit early without unnecessarily initializing connection
state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 10fd23b4-b903-47a6-b661-28fdeac1a08f

📥 Commits

Reviewing files that changed from the base of the PR and between 4ae1408 and b554ebe.

📒 Files selected for processing (12)
  • client/clients/router/client.go
  • client/pkg/batch/batch_controller.go
  • client/pkg/batch/batch_controller_test.go
  • client/pkg/deadline/watcher.go
  • client/resource_manager_client.go
  • client/servicediscovery/service_discovery.go
  • pkg/ratelimit/concurrency_limiter.go
  • pkg/ratelimit/concurrency_limiter_test.go
  • pkg/ratelimit/runner.go
  • pkg/ratelimit/runner_test.go
  • pkg/utils/syncutil/ordered_single_flight.go
  • pkg/utils/syncutil/ordered_single_flight_test.go

Comment thread client/servicediscovery/service_discovery.go
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 72 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.15%. Comparing base (4ae1408) to head (5d363b6).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10930      +/-   ##
==========================================
- Coverage   79.15%   79.15%   -0.01%     
==========================================
  Files         540      540              
  Lines       74801    74894      +93     
==========================================
+ Hits        59212    59282      +70     
- Misses      11405    11430      +25     
+ Partials     4184     4182       -2     
Flag Coverage Δ
unittests 79.15% <33.33%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot ti-chi-bot Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 23, 2026
rleungx added 2 commits June 23, 2026 15:37
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
pkg/ratelimit/concurrency_limiter_test.go (1)

119-155: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Test is correct, but only covers a single waiter.

This exercises the <-ctx.Done() path with one blocked waiter. It does not cover the multi-waiter case where one canceled waiter consumes a ReleaseToken wake-up via the <-l.queue branch (the lost-wakeup issue raised in concurrency_limiter.go). A test with two waiters on independent contexts—cancel one, expect the other to still acquire after a release—would guard that path.

Want me to draft a two-waiter cancellation test that asserts the surviving waiter still acquires the freed token?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/ratelimit/concurrency_limiter_test.go` around lines 119 - 155, The test
TestConcurrencyLimiterDoesNotReuseStaleQueuedToken only covers a single waiter
scenario and does not test the multi-waiter case where a canceled waiter might
consume a wake-up intended for another waiter via the queue channel, potentially
exposing a lost-wakeup issue. Create a new test with two concurrent goroutines
both calling AcquireToken with independent contexts on the same limited
concurrency limiter, cancel the first waiter's context, then release a token and
verify that the second waiter (not the canceled one) successfully acquires the
freed token.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/ratelimit/concurrency_limiter.go`:
- Around line 36-37: The NewConcurrencyLimiter function accepts a uint64 limit
parameter but implicitly converts it to an int when creating the channel buffer
with make(chan struct{}, limit). If the limit exceeds math.MaxInt64, this will
cause a runtime panic. Add a bounds validation check before the channel creation
in NewConcurrencyLimiter to ensure the limit does not exceed math.MaxInt64. You
can either return an error (if the function signature is updated), use a
sensible default value, or explicitly return nil with clear error messaging to
prevent invalid inputs from causing panics.
- Around line 136-149: In the `<-l.queue` case branch, when a waiter receives a
wake-up signal but finds its context is canceled (ctx.Err() is non-nil), the
signal is consumed and lost without being forwarded. This causes other waiting
goroutines to starve. After decrementing l.waiting and unlocking the mutex in
the cancellation error return path, send a signal back to the l.queue channel to
forward the consumed wake-up to the next waiter before returning the error.

---

Nitpick comments:
In `@pkg/ratelimit/concurrency_limiter_test.go`:
- Around line 119-155: The test
TestConcurrencyLimiterDoesNotReuseStaleQueuedToken only covers a single waiter
scenario and does not test the multi-waiter case where a canceled waiter might
consume a wake-up intended for another waiter via the queue channel, potentially
exposing a lost-wakeup issue. Create a new test with two concurrent goroutines
both calling AcquireToken with independent contexts on the same limited
concurrency limiter, cancel the first waiter's context, then release a token and
verify that the second waiter (not the canceled one) successfully acquires the
freed token.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 888aed12-46b3-45a4-b8b8-9294683c0f81

📥 Commits

Reviewing files that changed from the base of the PR and between 5d363b6 and e01fcd2.

📒 Files selected for processing (2)
  • pkg/ratelimit/concurrency_limiter.go
  • pkg/ratelimit/concurrency_limiter_test.go

Comment on lines 36 to +37
func NewConcurrencyLimiter(limit uint64) *ConcurrencyLimiter {
return &ConcurrencyLimiter{limit: limit, queue: make(chan *TaskToken, limit)}
return &ConcurrencyLimiter{limit: limit, queue: make(chan struct{}, limit)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect the unlimit constant and any construction with it.
rg -nP --type=go '\bunlimit\b' pkg/ratelimit
rg -nP --type=go -C2 'NewConcurrencyLimiter\s*\(' -g '!**/*_test.go'

Repository: tikv/pd

Length of output: 601


🏁 Script executed:

cat -n pkg/ratelimit/concurrency_limiter.go

Repository: tikv/pd

Length of output: 5341


🏁 Script executed:

rg -nP --type=go 'NewConcurrencyLimiter\s*\(' -A 2

Repository: tikv/pd

Length of output: 145


🏁 Script executed:

rg -nP --type=go 'NewConcurrencyLimiter' pkg/ratelimit --glob='!*_test.go'

Repository: tikv/pd

Length of output: 564


🏁 Script executed:

rg -nP --type=go 'NewConcurrencyLimiter' --glob='!*_test.go' -A 1

Repository: tikv/pd

Length of output: 145


🏁 Script executed:

cat -n pkg/ratelimit/limiter.go | head -110 | tail -80

Repository: tikv/pd

Length of output: 2541


🏁 Script executed:

rg -nP --type=go 'NewConcurrencyLimiter\(limit\)' -B 10 -A 2

Repository: tikv/pd

Length of output: 145


🏁 Script executed:

rg -nP --type=go 'ConcurrencyLimit' pkg/ratelimit -B 2 -A 2

Repository: tikv/pd

Length of output: 20320


🏁 Script executed:

rg -nP --type=go 'math.MaxInt' pkg/ratelimit

Repository: tikv/pd

Length of output: 145


Add bounds validation to prevent panic from oversized channel buffer.

The concern is valid: make(chan struct{}, limit) implicitly converts the uint64 parameter to int. If limit exceeds math.MaxInt64, the conversion panics with "makechan: size out of range". While current code only uses small values (0–100 in tests), there's no input validation preventing a caller from passing a uint64 value > math.MaxInt64 via DimensionConfig.ConcurrencyLimit.

Recommend adding a bounds check: either validate limit <= math.MaxInt64 before the make() call, or change the parameter type to int64 with appropriate validation at the public API boundary.

🧰 Tools
🪛 golangci-lint (2.12.2)

[error] 36-36: : # github.com/tikv/pd/pkg/dashboard/uiserver
pkg/dashboard/uiserver/embedded_assets_rewriter.go:36:26: undefined: assets
pkg/dashboard/uiserver/embedded_assets_rewriter.go:37:13: undefined: vfsgen۰FS
pkg/dashboard/uiserver/embedded_assets_rewriter.go:39:15: undefined: vfsgen۰CompressedFileInfo
pkg/dashboard/uiserver/embedded_assets_rewriter.go:47:9: undefined: assets

(typecheck)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/ratelimit/concurrency_limiter.go` around lines 36 - 37, The
NewConcurrencyLimiter function accepts a uint64 limit parameter but implicitly
converts it to an int when creating the channel buffer with make(chan struct{},
limit). If the limit exceeds math.MaxInt64, this will cause a runtime panic. Add
a bounds validation check before the channel creation in NewConcurrencyLimiter
to ensure the limit does not exceed math.MaxInt64. You can either return an
error (if the function signature is updated), use a sensible default value, or
explicitly return nil with clear error messaging to prevent invalid inputs from
causing panics.

Comment thread pkg/ratelimit/concurrency_limiter.go
Signed-off-by: Ryan Leung <rleungx@gmail.com>
@rleungx rleungx force-pushed the fix-select-cancel-races branch from 07bce4a to bf704ab Compare June 23, 2026 10:04

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
pkg/ratelimit/concurrency_limiter_test.go (2)

190-195: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Direct internal state manipulation couples test to implementation details.

The test directly manipulates the limiter's internal state (setting token.released, modifying limiter.current, sending to limiter.queue) instead of using the public ReleaseToken API. While this may be intentional to create a specific race scenario for testing the wake-up forwarding logic, it tightly couples the test to the internal implementation and makes it brittle.

If the internal queue structure or release mechanism changes (e.g., different wake-up signaling), this test will need updates even if the public behavior remains correct.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/ratelimit/concurrency_limiter_test.go` around lines 190 - 195, The test
is directly manipulating the limiter's internal state by locking the mutex,
setting token.released, modifying limiter.current, and sending to limiter.queue
instead of using the public API. Replace this direct internal state manipulation
block with a call to the public ReleaseToken method on the token object. This
will decouple the test from implementation details and make it more maintainable
if the internal wake-up signaling mechanism changes.

189-195: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Comment overstates ordering guarantees in concurrent scenario.

The comment claims to "force the first waiter to consume the wake-up before it observes cancellation," but after sending the wake-up (line 193) and canceling the context (line 194), both l.queue and ctx.Done() are ready in the select statement. Go's select will pseudo-randomly choose between the two cases, so the ordering is not actually forced.

However, the test should pass regardless because both paths produce correct behavior:

  • If ctx.Done() is selected first: wake-up remains in queue for survivingWaiter
  • If l.queue is selected first: canceledWaiter consumes wake-up, detects cancellation, and forwards a new wake-up for survivingWaiter

Consider updating the comment to reflect that this creates a race scenario rather than forcing a specific ordering, or restructure to deterministically test the forwarding path if that's the intent.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/ratelimit/concurrency_limiter_test.go` around lines 189 - 195, The
comment at the beginning of the test block claims to force a specific ordering
where the first waiter consumes the wake-up before observing cancellation, but
this overstates what actually happens. After sending a wake-up on l.queue and
then calling cancelCanceledWaiter() to trigger context cancellation, both
l.queue and ctx.Done() are simultaneously ready, so Go's select statement will
pseudo-randomly choose between them rather than guaranteeing the wake-up is
consumed first. Update the comment to accurately reflect that this creates a
race scenario between the queue and context cancellation cases, or alternatively
restructure the test to deterministically test the wake-up forwarding behavior
by ensuring proper ordering between the queue send and context cancellation
trigger.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/ratelimit/concurrency_limiter_test.go`:
- Around line 190-195: The test is directly manipulating the limiter's internal
state by locking the mutex, setting token.released, modifying limiter.current,
and sending to limiter.queue instead of using the public API. Replace this
direct internal state manipulation block with a call to the public ReleaseToken
method on the token object. This will decouple the test from implementation
details and make it more maintainable if the internal wake-up signaling
mechanism changes.
- Around line 189-195: The comment at the beginning of the test block claims to
force a specific ordering where the first waiter consumes the wake-up before
observing cancellation, but this overstates what actually happens. After sending
a wake-up on l.queue and then calling cancelCanceledWaiter() to trigger context
cancellation, both l.queue and ctx.Done() are simultaneously ready, so Go's
select statement will pseudo-randomly choose between them rather than
guaranteeing the wake-up is consumed first. Update the comment to accurately
reflect that this creates a race scenario between the queue and context
cancellation cases, or alternatively restructure the test to deterministically
test the wake-up forwarding behavior by ensuring proper ordering between the
queue send and context cancellation trigger.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 03a62b96-944c-466e-992a-353c51c39e4e

📥 Commits

Reviewing files that changed from the base of the PR and between e01fcd2 and bf704ab.

📒 Files selected for processing (2)
  • pkg/ratelimit/concurrency_limiter.go
  • pkg/ratelimit/concurrency_limiter_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/ratelimit/concurrency_limiter.go

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot

ti-chi-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@rleungx: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-unit-test-next-gen-3 a575cf8 link true /test pull-unit-test-next-gen-3
pull-unit-test-next-gen-2 a575cf8 link true /test pull-unit-test-next-gen-2

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

}
// Initialize the deadline.
timer := timerutil.GlobalTimerPool.Get(timeout)
d := &deadline{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it always need to close the deadline? If yes, pls add a defer func to close it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the dco. do-not-merge/needs-triage-completed release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Canceled contexts can still consume work in select-based paths

2 participants