`RuntimeWarning: coroutine 'ExecutionContext.execute_fields.<locals>.resolve' was never awaited` on 3.3.0a11
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 55/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Calme
- Stack technique
- python
- Domaine
- backend-api-design
Piste de recherche
Commencez par ExecutionContext.execute_fields et le point d’entrée experimental_execute_incrementally, en utilisant la reproduction minimale avec la requête { slow fast_fail }. Suivez la manière dont le resolver asynchrone mis en réserve et complete_awaitable_value sont gérés lorsque le resolver NonNull frère lève une exception. C’est terminé lorsque la requête renvoie toujours l’erreur d’exécution signalée, sans messages RuntimeWarning pour des coroutines non attendues.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Description
When executing a query with multiple fields, if an async field's resolver is processed first (its inner resolve() coroutine gets stashed for later), and a later sibling NonNull field raises synchronously, the exception escapes execute_fields immediately, before the stashed coroutine is ever awaited or closed. This results in:
RuntimeWarning: coroutine 'ExecutionContext.execute_fields.<locals>.resolve' was never awaited
Environment
- graphql-core: 3.3.0a11
- strawberry-graphql: 0.291.3 (via experimental_execute_incrementally)
- Python: 3.12.13
Minimal reproduction
from __future__ import annotations
import asyncio
import sys
from graphql import (
GraphQLField,
GraphQLNonNull,
GraphQLObjectType,
GraphQLSchema,
GraphQLString,
parse,
)
from graphql.execution import experimental_execute_incrementally
async def resolve_slow_async(_obj, _info):
await asyncio.sleep(0.01)
return "ok"
def resolve_sync_raises_nonnull(_obj, _info):
raise Exception("boom from sibling")
schema = GraphQLSchema(
query=GraphQLObjectType(
name="Query",
fields={
"slow": GraphQLField(GraphQLString, resolve=resolve_slow_async),
"fast_fail": GraphQLField(
GraphQLNonNull(GraphQLString),
resolve=resolve_sync_raises_nonnull,
),
},
)
)
async def run():
try:
result = experimental_execute_incrementally(
schema=schema,
document=parse("{ slow fast_fail }"),
)
if asyncio.iscoroutine(result):
result = await result
print(f"result: {result!r}")
except Exception as exc:
print(f"raised: {type(exc).__name__}: {exc}")
if __name__ == "__main__":
sys.exit(asyncio.run(run()))
Observed output
result: ExecutionResult(data=None, errors=[GraphQLError('boom from sibling', ...)])
sys:1: RuntimeWarning: coroutine 'resolve_slow_async' was never awaited
sys:1: RuntimeWarning: coroutine 'ExecutionContext.complete_awaitable_value' was never awaited
sys:1: RuntimeWarning: coroutine 'ExecutionContext.execute_fields.<locals>.resolve' was never awaited
- Langage dominant
- Python
- Étoiles
- 531
- Forks
- 147
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de graphql-python/graphql-core
-
Difficulté 4/5 3-5 jours Accessibilité débutants 50/100
graphql-python/graphql-core#272 · 1 commentaire ·
-
Publish a major version Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
graphql-python/graphql-core#267 · 1 commentaire ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
graphql-python/graphql-core#257 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
graphql-python/graphql-core#247 · 8 commentaires ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
graphql-python/graphql-core#223 · 1 commentaire ·
Toutes les issues de graphql-python/graphql-core
Issues similaires
-
[Bug] reef-hermes tells me to resume with hermes --resume, which does not work from my shell Ouvertearea: harness bug status: needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Human-Agent-Society/reef#625 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 80/100
learningequality/kolibri#15351 · 2 commentaires ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
Name consistency Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
eellak/triplestore#65 · 1 commentaire ·