Skip to content

Server side blazor Microsoft.JSInterop/SignalR exception when passing large strings #15498

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
Kaffeegangster opened this issue Oct 25, 2018 · 5 comments
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@Kaffeegangster
Copy link

passing or returning a string>32k with Microsoft.JSInterop throws an exception and closes SignalR connection. Do i need to implement some kind of argument chunking ? Is the blazor serialisation buffersize configurable?

Microsoft.AspNetCore.SignalR.HubConnectionHandler:Error: Error when processing requests.

System.InvalidOperationException: Advancing examined to the end would cause pipe to deadlock because FlushAsync is waiting.
at System.IO.Pipelines.ThrowHelper.ThrowInvalidOperationException_BackpressureDeadlock()
at System.IO.Pipelines.Pipe.AdvanceReader(BufferSegment consumedSegment, Int32 consumedIndex, BufferSegment examinedSegment, Int32 examinedIndex)
at System.IO.Pipelines.Pipe.AdvanceReader(SequencePosition& consumed, SequencePosition& examined)
at System.IO.Pipelines.Pipe.DefaultPipeReader.AdvanceTo(SequencePosition consumed, SequencePosition examined)
at Microsoft.AspNetCore.SignalR.HubConnectionHandler1.DispatchMessagesAsync(HubConnectionContext connection) at Microsoft.AspNetCore.SignalR.HubConnectionHandler1.RunHubAsync(HubConnectionContext connection)
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 11613.7288ms 101

@danroth27
Copy link
Member

You're hitting the default buffer size limit in SignalR. The error message isn't great, but there is an issue to address that. If you want to increase the buffer size you can do that by replacing the call to app.UseServerSideBlazor<App.Startup>() with:

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

@Kaffeegangster
Copy link
Author

thank you!

@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/blazor Oct 27, 2019
@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Oct 27, 2019
@Styx8888
Copy link

Is there any workaround for this using .net core 3.0 ?
I tried something like below, but it is not working:

app.UseEndpoints(endpoints => {
endpoints.MapBlazorHub(o =>
{
o.ApplicationMaxBufferSize = 92233720; // larger size
o.TransportMaxBufferSize = 92233720; // larger size
});

                           endpoints.MapFallbackToPage("/_Host");
        });

@BrennanConroy
Copy link
Member

@Styx8888
Copy link

Styx8888 commented Dec 3, 2019

Thanks, it works!

@ghost ghost locked as resolved and limited conversation to collaborators Jan 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

5 participants