Skip to content

fix: call async iterator return when next is pending on abort - #5007

Open
webdevelopersrinu wants to merge 1 commit into
graphql:17.x.xfrom
webdevelopersrinu:fix-async-iterator-return
Open

webdevelopersrinu wants to merge 1 commit into
graphql:17.x.xfrom
webdevelopersrinu:fix-async-iterator-return

Conversation

@webdevelopersrinu

Copy link
Copy Markdown

Fixes #5003

When a plain async-iterable list field's parent was nulled by a sibling error while next() was still pending, iterator.return() was never called. If next() never settles, the iterator leaks. The @stream path already calls return() right away in this case.

I changed completeAsyncIterableValue to race the pending next() against the executor's abort signal, and call return() when the abort wins. The pending next() promise goes to the async work tracker so a late rejection is not unhandled.

I added two tests, one for an external abort and one for a sibling error nulling the parent. All tests pass locally.

@vercel

vercel Bot commented Nov 18, 2026

Copy link
Copy Markdown

@webdevelopersrinu is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Async iterable list: return() not called while next() is pending when the parent is nulled (differs from the @stream path)

1 participant