grpc / grpc/grpc-dotnet

Support streaming calls in the `SubchannelCallTracker`

Open
#2,133 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
4.5k
Forks
836
Avg merge
6d 3h
Merged PRs (30d)
7

Description

### What version of gRPC and what language are you using?

Grpc.AspNetCore v2.53.0 in C#

### What operating system (Linux, Windows,...) and version?

Mac OSX Ventura

### What runtime / compiler are you using (e.g. .NET Core SDK version `dotnet --info`)

.NET 7.0.200

### What did you do?

I wrote a custom load balancer for client side load balancing. I used the `ISubchannelCallTracker` interface to detect when calls happen and complete on a subchannel to know what load they are bearing. This works fine for non-streaming grpc-calls, but it breaks down for streaming-calls.

### What did you expect to see?

That the `Complete`-function of the `ISubchannelCallTracker` is called once the `AsyncServerStreamingCall` is disposed in the user-code.

### What did you see instead?

The `Complete`-function is called right after the grpc-call is made, before even the first item is retriebed from the `ResponseStream` via `MoveNext`.

### Thoughts

I saw [this comment ](https://github.com/grpc/grpc-dotnet/blob/master/src/Grpc.Net.Client/Balancer/Internal/BalancerHttpHandler.cs#L152) in the source and wondered what it would take to handle this case correctly. `AsyncServerStreamingCall` does have a `disposeAction` already, but its not clear how it relates to the `HttpResponseMessage` in the other place and what else needs to be thought of. I would be happy to provide a PR if I could get some pointers.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.