Skip to content

Fixed large json deserialization regression #8415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

sunghwan2789
Copy link
Collaborator

@sunghwan2789 sunghwan2789 commented Jul 3, 2025

While a rented array used to create a JsonDocument requires its lifecycle to be tied to the JsonDocument's, this PR introduces a new method that is free from the issues observed before.

Closes #8376

@sunghwan2789 sunghwan2789 marked this pull request as ready for review July 3, 2025 05:48
@sunghwan2789 sunghwan2789 requested a review from Copilot July 3, 2025 06:04
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

A memory-efficient fix for large JSON deserialization by replacing the pooled buffer approach with a streaming Pipe-based writer and reader.

  • Replace PooledArrayWriter with Pipe and Utf8JsonWriter(pipe.Writer) in ResponseEnumerable
  • Add a new integration test (TestLarge) and supporting LargeQueryResolvers
  • Record a large-response snapshot for the new test

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/StrawberryShake/Client/src/Transport.Http/ResponseEnumerable.cs Swap out in-memory buffer for Pipe streaming and update parsing call
AnyScalarDefaultSerializationTest.cs Add Execute_AnyScalarDefaultSerialization_TestLarge test and LargeQueryResolvers
AnyScalarDefaultSerializationTest.Execute_AnyScalarDefaultSerialization_TestLarge.snap New snapshot capturing large JSON output
Comments suppressed due to low confidence (1)

src/StrawberryShake/Client/src/Transport.Http/ResponseEnumerable.cs:91

  • [nitpick] Switching to a Pipe-backed writer may introduce extra overhead for small payloads. Consider benchmarking or using a size threshold to fall back to the pooled buffer for smaller responses.
        var pipe = new Pipe();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AnyType result regression (in 15.1.5)
1 participant