Repository navigation
Closed
Labels
kind/bugSomething isn't working
Description
Context
Follow-up to #26473 (fixes #26467).
#26473 makes lockservice RPC recovery and shutdown deterministic under CI load. It deliberately bounds two remaining lifecycle risks rather than changing public interfaces in the same PR:
BackendFactory.Createhas nocontext.Context. Once a factory call starts, close/reconfigure can invalidate its generation but cannot interrupt a blocked DNS/dial/create call. The fixed worker pool limits concurrent damage, but does not provide prompt cancellation or a completion guarantee.- Unknown-commit completion callbacks are detached from the resolver stopper task to prevent callback re-entry into
Closefrom self-deadlocking. Current callbacks are short admission-release operations, but the public contract does not require that; an arbitrary blocking callback can still create unbounded completion work or shutdown latency.
Goal
Make both boundaries explicit, cancellable, and testable without regressing the safety properties delivered by #26473.
Acceptance criteria
1. Contextual backend creation
- Introduce a backward-compatible migration path to a contextual backend-factory API, or an equivalent adapter with an explicit cancellation contract.
- Propagate the manager/client generation lifetime into factory creation.
- On client close, manager replacement, or generation invalidation, cancel work that has not completed; late results must never be published into the replacement generation.
- Preserve error classification: local queue/cancellation/close errors remain transient and do not poison peer breaker evidence; definitive connection failures remain distinguishable.
- Keep factory concurrency bounded and prove workers do not leak after cancellation.
2. Completion-callback execution contract
- Define whether completion callbacks must be non-blocking. If arbitrary callbacks are supported, dispatch them through a bounded, cancellable/drainable executor with explicit ownership.
- Preserve the no-self-wait property when a callback re-enters
Close. - During service/server shutdown: seal callback admission, resolve or cancel admitted callback work, join/drain it, then release owned transports/tables.
- Bound queueing and define the fail-safe behavior when the dispatcher is saturated or stopping.
Required regression coverage
- A factory blocked after dequeue is cancelled by client close and by manager replacement; no late backend becomes visible, no worker leaks, and breaker state remains correct.
- Concurrent cancellation/retry/reconfigure stays within the configured factory-worker bound under
-racestress. - A completion callback that blocks, re-enters
Close, and races shutdown cannot deadlock, leak, or allow post-close callback admission. - Existing [Bug]: TestCallLockOpWithConflict / TestRemoteWithBindChanged / TestIssue26095 flaky — lockservice operation race #26467 / fix: stabilize lockservice RPC lifecycle under CI load #26473 deterministic lock-conflict, bind-change, and shutdown tests remain green under race stress.
Non-goals
- Do not reintroduce synchronous unbounded factory fallback.
- Do not weaken the fix: stabilize lockservice RPC lifecycle under CI load #26473 ordering: seal admission -> cancel/join admitted work -> drain queues -> release resources.
- Do not change peer-breaker behavior for local scheduler congestion.
Activity
fix: make backend creation cancellable and bound resolution callbacks (…
fix: make backend creation cancellable and bound resolution callbacks (…
fix: make backend creation cancellable and bound resolution callbacks (…
fix: make backend creation cancellable and bound resolution callbacks (…