Repository navigation
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Root-update ordering can deadlock initialization against disposal, and the fixed queue limit can terminate circuits during ordinary navigation when initialization is slow.
6 open issues
Add backpressure for enhanced-navigation batches · New Release the ordering barrier before awaiting render quiescence · New Notify the client before terminating the circuit · New Log client-triggered queue overflow below Error · New Await canceled update tasks before asserting disposal results · New Synchronize the test on the second hub invocation · New
What changed in this PR
This PR adds sequencing for Blazor Server root-component updates to preserve batch dependencies while custom circuit handlers initialize slowly.
Changes:
- Introduces a bounded update queue with disposal cancellation and overflow reporting.
- Adds unit coverage for ordering, disposal, queue limits, and acknowledgements.
- Adds a gated browser scenario for enhanced navigation during circuit initialization.
Validation: Source inspection only; tests and browser scenarios were not run.
| File | Description |
|---|---|
src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs |
Registers the test gate and its endpoints. |
src/Components/test/testassets/Components.TestServer/CircuitHandlerTestGate.cs |
Provides controllable circuit-initialization blocking for browser tests. |
src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs |
Tests enhanced navigation while initialization is blocked. |
src/Components/Server/test/Circuits/CircuitHostTest.cs |
Adds queue ordering, lifecycle, limit, and acknowledgement tests. |
src/Components/Server/src/Circuits/CircuitHost.cs |
Implements update sequencing, cancellation, and overflow handling. |
Review effort: Max
Comment on lines
+784
to
+787
| if (_pendingRootComponentUpdates >= MaxPendingRootComponentUpdates) | ||
| { | ||
| // Block updating components if they were provided during StartCircuit. This keeps | ||
| // the footprint for Blazor Server closer to what it was before. | ||
| throw new InvalidOperationException("UpdateRootComponents is not supported when components have" + | ||
| " been provided during circuit start up."); | ||
| _rootComponentUpdateQueueOverflowed = true; | ||
| reportQueueOverflow = true; |
| { | ||
| try | ||
| { | ||
| await previousUpdate.WaitAsync(_rootComponentUpdateCancellation.Token); |
Comment on lines
+814
to
+815
| UnhandledException?.Invoke(this, new UnhandledExceptionEventArgs(exception, isTerminating: false)); | ||
| await TryNotifyClientErrorAsync(Client, GetClientErrorMessage(exception), exception); |
| [LoggerMessage(116, LogLevel.Debug, "The root component operation of type 'Update' was invalid: {Message}", EventName = nameof(InvalidComponentTypeForUpdate))] | ||
| public static partial void InvalidComponentTypeForUpdate(ILogger logger, string message); | ||
|
|
||
| [LoggerMessage(117, LogLevel.Error, "Circuit '{CircuitId}' exceeded the limit of {MaxPendingRootComponentUpdates} pending root component updates.", EventName = nameof(RootComponentUpdateQueueOverflow))] |
| }) | ||
| .ToArray(); | ||
|
|
||
| await circuitHost.DisposeAsync(); |
Comment on lines
+324
to
+326
| Browser.Equal("False", () => Browser.FindElement(By.Id("is-interactive-1")).Text); | ||
|
|
||
| released = Post($"{ServerPathBase}/circuit-handler-test/release/{token}"); |
3 of 4 tasks
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.


Preserve root-component update ordering while custom circuit handlers initialize.