Skip to content

Provide a better error message when TransportMaxBufferSize exceeded in a single message #5307

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
analogrelay opened this issue Jun 13, 2018 · 3 comments
Assignees
Labels
accepted This issue has completed "acceptance" testing (including accessibility) area-signalr Includes: SignalR clients and servers blocked The work on this issue is blocked due to some dependency

Comments

@analogrelay
Copy link
Contributor

Right now, if you send a single message that serializes to larger than 32KB, you get:

fail: Microsoft.AspNetCore.SignalR.HubConnectionHandler[2]
      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.HubConnectionHandler`1.DispatchMessagesAsync(HubConnectionContext connection)
   at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.RunHubAsync(HubConnectionContext connection)
   
   fail: Microsoft.AspNetCore.SignalR.HubConnectionHandler[2]
      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.HubConnectionHandler`1.DispatchMessagesAsync(HubConnectionContext connection)
   at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.RunHubAsync(HubConnectionContext connection)

These errors are unpleasant. They occur because we are trying to read a single message that is larger than the backpressure size. We should provide a better error message in this case (heck, even if it takes just catching the exception). Something like "Message exceeded the maximum buffer size of {TransportMaxBufferSize} bytes"

It may be difficult to do this though, so we'll need to design this a bit (and may decide it's not feasible in the process).

@analogrelay
Copy link
Contributor Author

If we flow the maximum buffer size down to the reader, we can do this by checking the buffer size when TryParseMessage returns false and if it's equal to or greater than the maximum buffer size, we know this exception will occur and can throw our own better exception ("Message exceeded maxmium size").

@analogrelay
Copy link
Contributor Author

analogrelay commented Aug 20, 2018

https://github.com/dotnet/corefx/issues/30894 should resolve this sufficiently.

@aspnet-hello aspnet-hello transferred this issue from aspnet/SignalR Dec 17, 2018
@aspnet-hello aspnet-hello added this to the 3.0.0 milestone Dec 17, 2018
@aspnet-hello aspnet-hello added area-signalr Includes: SignalR clients and servers cost: 0 labels Dec 17, 2018
@muratg
Copy link
Contributor

muratg commented Jan 30, 2019

(This is just tracking dotnet/corefx#30894)

@davidfowl davidfowl assigned davidfowl and unassigned BrennanConroy Mar 3, 2019
@davidfowl davidfowl modified the milestones: 3.0.0, 3.0.0-preview4 Mar 3, 2019
@analogrelay analogrelay added release-3.0 blocked The work on this issue is blocked due to some dependency and removed status: Blocked labels Mar 21, 2019
@analogrelay analogrelay added the accepted This issue has completed "acceptance" testing (including accessibility) label Apr 16, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted This issue has completed "acceptance" testing (including accessibility) area-signalr Includes: SignalR clients and servers blocked The work on this issue is blocked due to some dependency
Projects
None yet
Development

No branches or pull requests

5 participants