Skip to content

[BUG] Cancelling a gateway gRPC result does not cancel the underlying ClientCall #8020

Closed

Description

@Aias00

Is there an existing issue for this?

  • I have searched the existing issues.

Current Behavior

ShenyuGrpcClient.call attaches a cancellation hook that cancels the ListenableFuture returned by invoke(). invoke() returns CompleteObserver's independent SettableFuture. That future has no cancellation listener connected to the ClientCall created in invoke(), so cancelling the gateway result does not call ClientCall.cancel(). MessageWriter has a call reference for aggregate-budget overflow, but that is a different cancellation path. The existing cancellation test replaces invoke() with a mocked future and checks only that future's cancelled flag.

Suggested severity: Medium: abandoned upstream work and response aggregation can continue after downstream cancellation.

Expected Behavior

Cancelling the returned CompletableFuture (including Reactor cancellation on disconnect) must propagate to the actual gRPC ClientCall and stop the server-side stream/work as far as the transport supports. Cancellation should be idempotent and safe against concurrent normal completion and aggregate overflow.

Steps To Reproduce

  1. Start an in-process or fake-channel server-streaming call that remains active and records cancellation.
  2. Invoke the real ShenyuGrpcClient.call()/invoke() path rather than mocking invoke().
  3. Cancel the returned CompletableFuture or cancel the subscribing gateway request.
  4. Assert that ClientCall.cancel() and the server cancellation signal are observed promptly. By inspection, current code only cancels CompleteObserver's SettableFuture; the call continues until completion, deadline or a separate aggregate-budget overflow.

This scenario has not been run in the reporting environment.

Environment

  • ShenYu: master / 2.7.2-SNAPSHOT, commit 34f2ed036747936a5e28aea2c94cd9b3cddcce47.
  • Evidence: source inspection. The reporting environment has no available Java runtime, so no Maven/JUnit execution or live reproduction is claimed.
  • These issues concern existing runtime behavior, not the proposed plugin DAG implementation.

Debug logs

No runtime logs captured; this report is based on the source paths below.

Code evidence

Suggested fix direction

Bind invocation-future cancellation to the actual ClientCall, or represent both through a shared invocation lifecycle object. Ensure the returned result and Reactor cancellation reach that same object; aggregate overflow and downstream cancellation should use one idempotent transport cleanup path.

Acceptance criteria

  • Verify real ClientCall cancellation, not just a mocked future flag.
  • Cover cancellation before the first response and during server streaming, plus unary calls.
  • Normal completion and error behavior remain correct; cancellation/completion races do not double-clean resources.
  • Existing aggregate count/byte overflow cancellation continues to work.

Related work

Related to the lifecycle covered around #7928 / #7940, but distinct from aggregate-budget overflow and outbound readiness #7927.

Activity

  1. added
    type: bug
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions