Skip to content

Proper way to be notified about stream failure #2540

Open
@ricsiLT

Description

@ricsiLT

Hi,

Recently I've run into the following situation:

  • consumer connects to stream
  • starts receiving data via ResponseStream.MoveNext()
  • consumer is too slow to process the data, he gets disconnected with RpcException(Aborted, "You're too slow")
  • consumer finishes processing last bit of data that's available to him, uses RequestStream.WriteAsync() to write an ack, receives RpcException(Cancelled, "") (due to underlying HttpClient being disconnected I presume?)

At this stage, if consumer were to interact with ResponseStream, he'd actually receive the correct Exception.

Is this intended? Could those exceptions be synced up somehow? And most importantly - was the question clear enough or should I write a repro? :D

For visual clue, I suppose best representation would be:

while (await responseStream.MoveNext())
{
    var message = responseStream.Current;
    ProcessMessage(message); // <--- Takes too long, consumer is disconnected after this line
    await requestStream.WriteAsync(message); // <--- this will fail, but it will fail with a different exception than what I'd expect. Tho I understand why it has to be this way.
}

It feels like even knowing that requestStream is dead, you're supposed to finish reading MoveNext() to get the real reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions