Skip to content

Blazor Server website always displays connection redirecting UI after page load #30483

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

Closed
JamesNK opened this issue Feb 26, 2021 · 10 comments
Closed
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-server
Milestone

Comments

@JamesNK
Copy link
Member

JamesNK commented Feb 26, 2021

Describe the bug

https://themesof.net/ always displays the connection reconnecting UI after page load. It is displayed for a couple of seconds and then disappears.

Is Blazor Server being too aggressive with assuming a lost connection?

To Reproduce

  1. Visit https://themesof.net/
  2. "Reconnecting attempt 1 of 8" displayed for a couple of seconds
  3. Website then works normally

Further technical details

Website source: https://github.com/terrajobst/themesof.net

@terrajobst

@JamesNK JamesNK added the area-blazor Includes: Blazor, Razor Components label Feb 26, 2021
@JamesNK
Copy link
Member Author

JamesNK commented Feb 26, 2021

Screen capture:

themesofnet

@benaadams
Copy link
Member

I end up with multiple connects; one per new node (fresh data) opened

themesof_Trim.mp4

@terrajobst
Copy link

terrajobst commented Feb 26, 2021 via email

@benaadams
Copy link
Member

Ignoring the disconnects it is working ok (e.g. loading the nodes etc)

It does send some chonk messages
image

Looking at that might be busting the 32kB limit

// Selected because this is the default value of PipeWriter.PauseWriterThreshold.
// There maybe the opportunity for performance gains by tuning this default.
private const int DefaultPipeBufferSize = 32768;
/// <summary>
/// Initializes a new instance of the <see cref="HttpConnectionDispatcherOptions"/> class.
/// </summary>
public HttpConnectionDispatcherOptions()
{
AuthorizationData = new List<IAuthorizeData>();
Transports = HttpTransports.All;
WebSockets = new WebSocketOptions();
LongPolling = new LongPollingOptions();
TransportMaxBufferSize = DefaultPipeBufferSize;
ApplicationMaxBufferSize = DefaultPipeBufferSize;
}

Looking at #5623 (comment); you may need to up these limits in Configure

app.UseSignalR(route => route.MapHub<BlazorHub>(BlazorHub.DefaultPath, o =>
{
    o.ApplicationMaxBufferSize = 131072; // larger size
    o.TransportMaxBufferSize = 131072; // larger size
}));
app.UseBlazor<App.Startup>();

@benaadams
Copy link
Member

@benaadams
Copy link
Member

Specifically In ConfigureServices

            services.AddServerSideBlazor()
                .AddHubOptions(options =>
                {
                    // Increase the limits to 256 kB
                    options.MaximumReceiveMessageSize = 262144;
                });

and in Configure

                endpoints.MapBlazorHub(options => 
                {
                    // Increase the limits to 256 kB
                    options.ApplicationMaxBufferSize = 262144;
                    options.TransportMaxBufferSize = 262144;
                });

@javiercn
Copy link
Member

This is likely the message going up exceeding the underlying max message size as @benaadams image shows.
Sending messages to the client doesn't have a limit I believe.

Do we know what's causing such a big message to be sent?

@benaadams
Copy link
Member

The list of open nodes ThemesOfDotNet/Pages/Index.razor.cs#L572-L579

image

With all the nodes closed there isn't a big post from the client
image

With all of them open there is a 33.9kB post (followed by a 468 kB response with the data for the open nodes)

image

Sending messages to the client doesn't have a limit I believe.

For the first large message on startup it does look like render-mode="ServerPrerendered" still sends the full data on the first message rather than using the Prerendered state?

image

@mkArtakMSFT mkArtakMSFT added this to the Discussions milestone Mar 1, 2021
@mkArtakMSFT
Copy link
Contributor

@javiercn moved this to the Discussions. Please include any pending work from here in your Blazor Server Improvements issues so that we can track those.

@ghost
Copy link

ghost commented Jun 19, 2021

Thank you for contacting us. Due to a lack of activity on this discussion issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue.

This issue will be locked after 30 more days of inactivity. If you still wish to discuss this subject after then, please create a new issue!

@ghost ghost closed this as completed Jun 19, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jul 19, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-server
Projects
None yet
Development

No branches or pull requests

5 participants