Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

`RuntimeWarning: coroutine 'ExecutionContext.execute_fields.<locals>.resolve' was never awaited` on 3.3.0a11

オープン
#269 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python

調査の方向性

ExecutionContext.execute_fields とエントリーポイント experimental_execute_incrementally から開始し、{ slow fast_fail } クエリを使った最小限の再現ケースを使用します。兄弟の NonNull リゾルバーが例外を発生させたときに、退避された非同期リゾルバーと complete_awaitable_value がどのように処理されるかを追跡します。クエリが報告された実行エラーを引き続き返し、await されていないコルーチンに対する RuntimeWarning メッセージが出ないことが完了条件です。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
Python
スター
531
フォーク
147
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

graphql-python/graphql-core のほかの issue

graphql-python/graphql-core の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。