Skip to content

[Follow-up]: make MORPC factory creation cancellable and bound lockservice completion callbacks #26474

Closed

Description

@XuPeng-SH

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:

  1. BackendFactory.Create has no context.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.
  2. Unknown-commit completion callbacks are detached from the resolver stopper task to prevent callback re-entry into Close from 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

Non-goals

References

Activity

  1. self-assigned this
    on Jul 31, 2026
  2. added
    kind/bug
    on Jul 31, 2026
  3. added a commit that references this issue on Aug 10, 2026
    5a753ba
  4. added 3 commits that reference this issue on Sep 17, 2026
    5ae3469
    dfc5165
    9409d5c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions