Title: Cancel resolver tasks if execution of an operation is terminated · Issue #217 · graphql-python/graphql-core · GitHub
Open Graph Title: Cancel resolver tasks if execution of an operation is terminated · Issue #217 · graphql-python/graphql-core
X Title: Cancel resolver tasks if execution of an operation is terminated · Issue #217 · graphql-python/graphql-core
Description: TL;DR Would it be possible to cancel outstanding resolver tasks as soon as before execution of a GraphQL operation is terminated? Outstanding / unused tasks can happen as a result of an incoercible field resolver error. These outstanding...
Open Graph Description: TL;DR Would it be possible to cancel outstanding resolver tasks as soon as before execution of a GraphQL operation is terminated? Outstanding / unused tasks can happen as a result of an incoercible...
X Description: TL;DR Would it be possible to cancel outstanding resolver tasks as soon as before execution of a GraphQL operation is terminated? Outstanding / unused tasks can happen as a result of an incoercible...
Opengraph URL: https://github.com/graphql-python/graphql-core/issues/217
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cancel resolver tasks if execution of an operation is terminated","articleBody":"### TL;DR\r\n\r\nWould it be possible to cancel outstanding resolver tasks ~as soon as~ _before_ execution of a GraphQL operation is terminated? Outstanding / unused tasks can happen as a result of an incoercible field resolver error.\r\n\r\nThese outstanding tasks can run well after lifecycle hooks responsible for cleaning up their context have completed. As a result, they often fail and cause a lot of noisy errors for us. \r\n\r\n### More details\r\n\r\nHello!\r\n\r\nI'm coming from the `strawberry-graphql` project. We're running into a problem with abandoned resolver tasks not being cancelled, and thus failing in unpredictable ways.\r\n\r\nStrawberry has an [extensions framework](https://strawberry.rocks/docs/guides/custom-extensions#execution-context) which allows you to wrap the execution phase of your operation processing in hooks – running code before and after execution of resolvers. We use these hooks to manage (set up and tear down) some state needed by the resolvers.\r\n\r\nHowever, when a resolver of a non-nullable field fails, it may lead to the results of some other resolvers being no longer necessary. It appears that `graphql-core` will then short-circuit returning a result, while the no-longer-necessary resolvers are still running. We see that they can continue running well after the HTTP response was returned.\r\n\r\nThe problem is that Strawberry's lifecycle hooks (and I also imagine - the webserver's) would have completed by that time. As a result, we do things like terminate the DB session – making it very likely that these outstanding tasks will fail with various esoteric errors. This causes a lot of noise in our observability suite – which we'd love to avoid.\r\n\r\nSee https://github.com/strawberry-graphql/strawberry/issues/3414 for more details, and https://github.com/strawberry-graphql/strawberry/issues/3414#issuecomment-2012060461 for the comment which recommends I report the issue here.","author":{"url":"https://github.com/kkom","@type":"Person","name":"kkom"},"datePublished":"2024-03-22T01:29:58Z","url":"https://github.com/graphql-python/graphql-core/issues/217"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1d9ef3f8-d1ee-69fd-c2fd-0f1366d0a452 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E972:1833B7:113B361:1702420:6AFFC7E0 |
| html-safe-nonce | e3004eeeef3c6f27b506743ef1e1ca8befed591badb36b5f6888689b2084eba6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTcyOjE4MzNCNzoxMTNCMzYxOjE3MDI0MjA6NkFGRkM3RTAiLCJ2aXNpdG9yX2lkIjoiMzk3MjM2OTExMzAzMTg4NjgxNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f1594fbbacfb9567f71c902108a73f1b762304ac6af468569c045045be92d361 |
| hovercard-subject-tag | issue:2201502442 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/graphql-python/graphql-core/217/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bcf2225b2bce31cd5556577781e4b73a7ab49219533ea414e4a3b3e61c63a65b/graphql-python/graphql-core/issues/217 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bcf2225b2bce31cd5556577781e4b73a7ab49219533ea414e4a3b3e61c63a65b/graphql-python/graphql-core/issues/217 |
| og:image:alt | TL;DR Would it be possible to cancel outstanding resolver tasks as soon as before execution of a GraphQL operation is terminated? Outstanding / unused tasks can happen as a result of an incoercible... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kkom |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1e805b832df235bb21305db712c3b6432920019dfc12cb25b9cb8d3b0c9403cf |
| turbo-cache-control | no-preview |
| go-import | github.com/graphql-python/graphql-core git https://github.com/graphql-python/graphql-core.git |
| octolytics-dimension-user_id | 15002022 |
| octolytics-dimension-user_login | graphql-python |
| octolytics-dimension-repository_id | 143207933 |
| octolytics-dimension-repository_nwo | graphql-python/graphql-core |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 143207933 |
| octolytics-dimension-repository_network_root_nwo | graphql-python/graphql-core |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8fa4a54e6871c7908eda1c246ad5972982c0b59d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width