Skip to content

Fix chunked reading of request body#9065

Merged
tobias-tengler merged 2 commits intomainfrom
tte/fix-request-parser
Jan 26, 2026
Merged

Fix chunked reading of request body#9065
tobias-tengler merged 2 commits intomainfrom
tte/fix-request-parser

Conversation

@tobias-tengler
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings January 26, 2026 13:53
Copy link
Copy Markdown
Contributor

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

This PR fixes a critical bug in chunked reading of HTTP request bodies where the loop would terminate prematurely if the last read returned fewer bytes than the chunk size, even when more data was available in the stream.

Changes:

  • Fixed chunked reading logic in DefaultHttpRequestParser.ParsePersistedOperationRequestAsync by changing the loop condition from read == chunkSize to read > 0
  • Fixed chunked reading logic in DynamicEndpointMiddleware.BuildVariablesAsync with the same change and improved the empty body check from read == 0 to writer.Length == 0
  • Removed commented-out code for max request size validation in DynamicEndpointMiddleware

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Parsers/DefaultHttpRequestParser.cs Fixed chunked reading bug in ParsePersistedOperationRequestAsync method by correcting the while loop condition
src/HotChocolate/Adapters/src/Adapters.OpenApi.Core/Execution/DynamicEndpointMiddleware.cs Fixed chunked reading bug in BuildVariablesAsync method, improved empty body validation, and removed commented code

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tobias-tengler tobias-tengler merged commit a616015 into main Jan 26, 2026
116 checks passed
@tobias-tengler tobias-tengler deleted the tte/fix-request-parser branch January 26, 2026 14:18
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (7c456a0) to head (59b9d05).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #9065   +/-   ##
============================
============================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Fusion Gateway Performance Results

Simple Composite Query

Constant Load (50 VUs)

Requests/sec Error Rate
5776.08 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.82ms 7.15ms 163.56ms 8.50ms 13.39ms 19.11ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
4517.03 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.79ms 38.33ms 262.41ms 49.17ms 110.84ms 130.97ms

Executed Query

fragment User on User {
  id
  username
  name
}

fragment Review on Review {
  id
  body
}

fragment Product on Product {
  inStock
  name
  price
  shippingEstimate
  upc
  weight
}

query TestQuery {
  topProducts(first: 5) {
    ...Product
    reviews {
      ...Review
      author {
        ...User
      }
    }
  }
}

Deep Recursion Query

Constant Load (50 VUs)

Requests/sec Error Rate
266.91 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
12.77ms 174.78ms 869.44ms 181.61ms 225.96ms 251.23ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
304.39 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
3.16ms 689.89ms 1676.28ms 694.22ms 1390.55ms 1491.96ms

Executed Query

fragment User on User {
  id
  username
  name
}

fragment Review on Review {
  id
  body
}

fragment Product on Product {
  inStock
  name
  price
  shippingEstimate
  upc
  weight
}

query TestQuery {
  users {
    ...User
    reviews {
      ...Review
      product {
        ...Product
        reviews {
          ...Review
          author {
            ...User
            reviews {
              ...Review
              product {
                ...Product
              }
            }
          }
        }
      }
    }
  }
  topProducts(first: 5) {
    ...Product
    reviews {
      ...Review
      author {
        ...User
        reviews {
          ...Review
          product {
            ...Product
          }
        }
      }
    }
  }
}

Variable Batching Throughput

Constant Load (50 VUs)

Requests/sec Error Rate
23939.80 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.09ms 1.68ms 47.19ms 2.04ms 3.88ms 4.75ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
19138.91 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.09ms 9.04ms 104.32ms 11.07ms 22.92ms 27.68ms

Executed Query

query TestQuery_8f7a46ce_2(
  $__fusion_1_upc: ID!
  $__fusion_2_price: Long!
  $__fusion_2_weight: Long!
) {
  productByUpc(upc: $__fusion_1_upc) {
    inStock
    shippingEstimate(weight: $__fusion_2_weight, price: $__fusion_2_price)
  }
}

Variables (5 sets batched in single request)

[
  { "__fusion_1_upc": "1", "__fusion_2_price": 899, "__fusion_2_weight": 100 },
  { "__fusion_1_upc": "2", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 },
  { "__fusion_1_upc": "3", "__fusion_2_price": 15, "__fusion_2_weight": 20 },
  { "__fusion_1_upc": "4", "__fusion_2_price": 499, "__fusion_2_weight": 100 },
  { "__fusion_1_upc": "5", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 }
]

No baseline data available for comparison.


Run 21360500881 • Commit 86fdb16 • Mon, 26 Jan 2026 14:23:20 GMT

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.

2 participants