Fixed concurrency issue in MetaDb chunk expansion#9508
Conversation
There was a problem hiding this comment.
Pull request overview
Addresses a concurrency hazard in ResultDocument.MetaDb chunk-array expansion by preventing pooled chunk buffers from being returned while they may still be observed by concurrent readers, and adds an integration regression test intended to cover the large paging + DataLoader scenario.
Changes:
- Retain the previous
_chunksbuffer across expansions and only return it to the pool on the next expansion orDispose. - Introduce a volatile cursor value (
_nextValue) to provide an atomic/read-friendly cursor snapshot for readers. - Add a new integration test that pages 100,000 nodes and resolves a composite DataLoader field with a wide selection set.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/Issue9500Tests.cs | Adds a large paging + DataLoader integration test aimed at reproducing the reported failure mode. |
| src/HotChocolate/Core/src/Types/Text/Json/ResultDocument.MetaDb.cs | Prevents premature ArrayPool returns during chunk-array expansion; adds an atomic cursor snapshot for concurrent readers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9508 +/- ##
==========================================
- Coverage 74.16% 0 -74.17%
==========================================
Files 2677 0 -2677
Lines 140790 0 -140790
Branches 16371 0 -16371
==========================================
- Hits 104421 0 -104421
+ Misses 30774 0 -30774
+ Partials 5595 0 -5595
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes #9500