Skip to content
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

Proper way to be notified about stream failure #2540

Open
ricsiLT opened this issue Sep 20, 2024 · 1 comment
Open

Proper way to be notified about stream failure #2540

ricsiLT opened this issue Sep 20, 2024 · 1 comment
Labels
question Further information is requested

Comments

@ricsiLT
Copy link

ricsiLT commented Sep 20, 2024

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.

@ricsiLT ricsiLT added the question Further information is requested label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants
@ricsiLT and others