Skip to content

Cancellation signal is not propagated from transports to reactive controller methods #1149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bclozel opened this issue Mar 11, 2025 · 0 comments
Assignees
Labels
in: core Issues related to config and core support type: bug A general bug
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Mar 11, 2025

As raised in #450, cancel signals are not propagated from the transport layer, through the ExecutionGraphQlService, up to the data fetchers provided by the application. This mostly applies to controller handlers with a Publisher-like return type and subscriptions in general. This is due to a well-known CompletableFuture behavior.

We can work around this limitation by propagating this signal out of band through a Sink in the GraphQL context.

@bclozel bclozel added in: core Issues related to config and core support type: bug A general bug labels Mar 11, 2025
@bclozel bclozel added this to the 1.3.5 milestone Mar 11, 2025
@bclozel bclozel self-assigned this Mar 11, 2025
bclozel added a commit that referenced this issue Mar 14, 2025
bclozel added a commit that referenced this issue Mar 28, 2025
As of gh-1149, CANCEL signals are propagated from the transport request
up to reactive `DataFetcher`s. This efficiently cancels processing and
avoids spending resources when execution results won't be sent to the
client.
Prior to this commit, this would have no effect on non-reactive
`DataFetcher`s because they would still be executed. While we cannot
consistently cancel ongoing blocking operations, we can avoid further
processing and other `DataFetcher`s from being called by returning an
error result instead of the original result.

This commit updates the `ContextDataFetcherDecorator` to detect if the
request has been cancelled and return early a data fetcher result with a
`AbortExecutionException` error instead of the original result.

Closes gh-1153
@bclozel bclozel marked this as a duplicate of #1094 Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues related to config and core support type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant