Hi Everyone,

I'm using grpc in combination with rx observables and now I'm running into
an issue where I sometimes get the following exception:

System.InvalidOperationException

Message=Only one write can be pending at a time

at Grpc.Core.Internal.AsyncCallServer`2.CheckSendAllowedOrEarlyResult()


I've been searching for what this means and how to resolve this and came
across a stack overflow post <https://stackoverflow.com/a/41869217> that 
mentions that there can be only one in-flight
message at any one time. However, I think I did that with my implementation:

public override Task MachineStatusStream(
    StatusStreamRequest request,
    grpc.IServerStreamWriter<StatusStreamResponse> responseStream,
    grpc.ServerCallContext context)
{
    return _alarmPresenter.AlarmStatusStream()
        .Select(status => status.ToGrpc())
        .Select(status => new StatusStreamResponse { Status = status })
        .ForEachAsync(response =>
            
responseStream.WriteAsync(response).Wait(context.CancellationToken));
}

Isn't the `.Wait()` in the write async enough to guarantee that the write 
is finished?

Any pointers or help would be highly appreciated!

Best regards,

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/6555421c-5c63-472c-adc6-0e1e56ad48a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to