Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

HubConnectionHandler Crash When Sending Large Amounts of Data #2322

@Jon-Murray

Description

@Jon-Murray

Hi Guys,

I have been testing and have found the following crash whenever a "large" (2MB in my test) amount of data is sent from the server -> client. The crash occurs in the following code within HubConnectionHandler.cs:

            finally
            {
                // The buffer was sliced up to where it was consumed, so we can just advance to the start.
                // We mark examined as buffer.End so that if we didn't receive a full frame, we'll wait for more data
                // before yielding the read again.
                input.AdvanceTo(buffer.Start, buffer.End);
            }

I've modified it slightly, but here is my console output for an example crash:

Buffer start: 429 end : 429
Buffer start: 0 end : 2048
Buffer start: 0 end : 2048
Buffer start: 0 end : 2048
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) in C:\Users\Jon\Desktop\testproject\SignalR_2_1_\Microsoft.AspNetCore.SignalR.Core\HubConnectionHandler.cs:line 215

This would then crash the connection (i.e. uncleanly close it for all clients that the file is being pushed to). The test functionality in question is uploading an image to redis (as a blob) over HTTP, then retrieving it via SignalR to the clients. I appreciate a lot has changed, but there was no issue with this in previous (< core 2.1) code. Unsure as to what else i can do here to help but if there's anything more please let me know.

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions