Repository navigation
Fix Fusion gateway never detecting stalled subscription streams - #10281
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a reliability gap in Fusion gateway subscriptions where a stalled (but still connected) subgraph streaming response could cause the gateway to wait indefinitely. It introduces a configurable per-read timeout on streaming subscription responses (SSE / JSON Lines) so that “no bytes received” is detected and surfaced as a terminal subscription error, while still treating keep-alives as activity.
Changes:
- Add
ReadTimeoutStreamand thread thereadTimeoutparameter throughGraphQLHttpResponsestreaming readers (SSE + JSONL) and the Fusion HTTP source schema subscription client. - Introduce
SubscriptionReadTimeoutconfiguration (default 60s, supportsTimeout.InfiniteTimeSpan) and propagate it through Fusion gateway builder APIs and test harnesses. - Adjust subscription/event-stream execution nodes to emit a single terminal error result on failed reads/decodes (with improved arena ownership handling), and add/extend tests for stall detection and keep-alive behavior.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Transport/Http/SseReaderTests.cs | Update SSE reader tests for new readTimeout constructor parameter. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Subscriptions/EventStreamBrokerReadFailureTests.cs | Extend tests to assert terminal error-result behavior on broker read failure and continued operation on decode failure. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Clients/HttpSourceSchemaClientConfigurationTests.cs | New tests for default/disabled/out-of-range SubscriptionReadTimeout configuration. |
| src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/FusionTestBase.cs | Plumb SubscriptionReadTimeout through composite schema creation helper options. |
| src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/FusionTestBase.CreateSourceSchema.cs | Add subscriptionReadTimeout support to source schema test server creation helpers. |
| src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/CancellationTests.cs | Add coverage for stalled stream detection vs keep-alives, and client disconnect teardown across SSE/JSONL. |
| src/HotChocolate/Fusion/src/Fusion.Execution/HotChocolate.Fusion.Execution.csproj | Include ReadTimeoutStream.cs in Fusion.Execution build. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/OperationPlanExecutor.cs | Ensure per-event CTS is refreshed if canceled between events due to error/null-propagation. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/OperationExecutionNode.cs | Emit a terminal error result on transport read failures and tighten arena ownership handling. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/EventStreamExecutionNode.cs | Emit terminal error result on broker read failure; keep subscription alive on per-message decode failure; improve arena handling. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/HttpSourceSchemaClientConfiguration.cs | Add configurable SubscriptionReadTimeout with validation and a 60s default. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Clients/HttpSourceSchemaClient.cs | Apply SubscriptionReadTimeout to streaming response reads during subgraph subscriptions. |
| src/HotChocolate/Fusion/src/Fusion.Execution/DependencyInjection/CoreFusionGatewayBuilderExtensions.SourceSchemaClients.cs | Add optional subscriptionReadTimeout to gateway builder configuration APIs and docs. |
| src/HotChocolate/AspNetCore/test/Transport.Http.Tests/ReadTimeoutStreamTests.cs | New tests validating timeout behavior, cancellation behavior, and range checks. |
| src/HotChocolate/AspNetCore/src/Transport.Http/Sse/SseReader.cs | Wrap response stream with ReadTimeoutStream for Fusion streaming reads. |
| src/HotChocolate/AspNetCore/src/Transport.Http/ReadTimeoutStream.cs | New stream wrapper enforcing per-read timeouts with clear timeout exceptions. |
| src/HotChocolate/AspNetCore/src/Transport.Http/JsonLines/JsonLinesReader.cs | Wrap response stream with ReadTimeoutStream for Fusion JSONL streaming reads. |
| src/HotChocolate/AspNetCore/src/Transport.Http/GraphQLHttpResponse.cs | Add readTimeout overload for Fusion streaming reads and validate timeout range. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+94
to
+101
| catch (Exception) when (timeoutSource.IsCancellationRequested | ||
| && !cancellationToken.IsCancellationRequested | ||
| && !_disposed) | ||
| { | ||
| throw new TimeoutException( | ||
| "No data (including keep-alive messages) was received on the response stream " | ||
| + $"within the configured read timeout of {FormatTimeout(_timeout)}."); | ||
| } |
| var configuration = new HttpSourceSchemaClientConfiguration("A", s_baseAddress); | ||
|
|
||
| // assert | ||
| Assert.Equal(TimeSpan.FromSeconds(60), configuration.SubscriptionReadTimeout); |
This was referenced Aug 29, 2026
Merged
This was referenced Sep 8, 2026
Closed
Closed
This was referenced Sep 15, 2026
Closed
[nuget][SUI_Matcher]- Bump the sui-package-updates group with 20 updates
DFE-Digital/SUI_Matcher#405
Closed
Closed
This was referenced Sep 22, 2026
Closed
Closed
[nuget][SUI_Matcher]- Bump the sui-package-updates group with 20 updates
DFE-Digital/SUI_Matcher#410
Merged
This was referenced Oct 5, 2026
Open
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.
Fixes #10273, #8976, #8977, #10117