Skip to content

Avoid accumulating tracebacks on ValidationAbortedError - #288

Closed
Fire162 wants to merge 1 commit into
graphql-python:mainfrom
Fire162:fix-validation-aborted-error-traceback
Closed

Fire162 wants to merge 1 commit into
graphql-python:mainfrom
Fire162:fix-validation-aborted-error-traceback

Conversation

@Fire162

@Fire162 Fire162 commented Oct 24, 2026

Copy link
Copy Markdown

Fixes #287.

Instantiate ValidationAbortedError on demand and clear its traceback when caught so aborted validations do not keep frames alive on the error. Keep validation_aborted_error defined at module scope for backwards compatibility.

@Cito

Cito commented Oct 25, 2026

Copy link
Copy Markdown
Member

Thanks a lot for the quick PR, @Fire162! It fixes the leak reported in #287, but I went with a slightly different fix in #289:

  • The aborted error could still keep the frames alive through __context__ when the error limit is reached while an exception is being handled, e.g. when OverlappingFieldsCanBeMergedRule reports an exceeded comparison budget.
  • The custom __init__ would no longer accept the positional arguments of GraphQLError.
  • The module-level validation_aborted_error is not exported, so it can be removed.

It would be great if you could take a look at #289 as well. I'm going to release 3.3.1 with it shortly, and you will be mentioned in the release notes. I'll close this PR when #289 is merged.

@Cito

Cito commented Oct 25, 2026

Copy link
Copy Markdown
Member

The fix from #289 has been released in GraphQL-core 3.3.1, so I'm closing this one. Thanks again for your PR, @Fire162!

@Cito Cito closed this Oct 25, 2026
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.

Memory leak: the shared validation_aborted_error keeps every traceback it is raised through

2 participants