Fix ResolverTask running cleanup after scheduler completion#9984
Open
michaelstaib wants to merge 1 commit into
Open
Fix ResolverTask running cleanup after scheduler completion#9984michaelstaib wants to merge 1 commit into
michaelstaib wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a race where ResolverTask could mark itself complete with the WorkScheduler before running resolver cleanup tasks, allowing the shared OperationContext to be recycled while cleanup is still executing. It also adds a regression test that stresses concurrent entity resolution to catch the previously unobserved ObjectDisposedException scenario.
Changes:
- Reordered
ResolverTaskfinalization to run cleanup tasks before notifying the scheduler of completion (while still guaranteeing scheduler completion + pool return viafinally). - Added a concurrency-focused Apollo Federation test that attempts to surface unobserved task exceptions caused by resolver context cloning/cleanup timing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/HotChocolate/Core/src/Types/Execution/Processing/Tasks/ResolverTask.Execute.cs |
Ensures cleanup executes before scheduler completion and always completes/returns the task even if cleanup faults. |
src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/EntitiesResolverForObjectTests.cs |
Adds a stress/regression test for concurrent _entities resolution and unobserved task exceptions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+291
to
+292
| var deadline = DateTimeOffset.UtcNow.AddSeconds(8); | ||
| var workers = new Task[256]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.