gRPC Streaming From C# Resulting in GoAway error from server
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 836
- Avg merge
- 6d 3h
- Merged PRs (30d)
- 7
Description
In the solution attached below, we're trying to make gRPC requests to the Google GenerativeAI API, which is supposed to return a streaming response. However, this is inconsistently successful, as a significant fraction of the streaming responses are cut short with a GoAway error (seen in the txt output file also attached below). In the output, you can see the GoAway comes with output frame 13, but we have noticed that the frame number at which this happens, if at all, is also not consistent.
To reproduce our issue, install open the console app included in the attached ZIP file. You will need an API key from https://ai.google.dev/tutorials/setup and fill it in where the `// TODO` is. Then, run the console app. The app will make 100 calls to the generative AI API with a pre-filled prompt, and at the end you will see how many calls failed (ranges from anywhere between 1 failure to up to 26). I create the proto file using the structures I need from the [publicly available protobuf here](https://github.com/googleapis/googleapis/blob/master/google/ai/generativelanguage/v1beta/generative_service.proto#L62).
The gRPC calls to this server are consistently successful from the [Python client](https://github.com/google/generative-ai-python/blob/main/google/generativeai/generative_models.py#L245C38-L245C38), but we haven't gotten it to succeed 100% of the time with C#. We believe that there might be a flag or header that we're missing to prevent the server from sending us the GoAway, but we don't know what it could be. Please advise.
[GrpcStream.zip-20240111T225040Z-001.zip](https://github.com/grpc/grpc-dotnet/files/13923920/GrpcStream.zip-20240111T225040Z-001.zip)
[SampleGrpcStreamOutput.txt](https://github.com/grpc/grpc-dotnet/files/13923921/SampleGrpcStreamOutput.txt)
Contributor guide
Research direction
Start with the attached GrpcStream.zip-20240111T225040Z-001.zip console app, add the API key at the marked TODO, and run its 100 streaming calls. Inspect SampleGrpcStreamOutput.txt and compare the failures with the successful Python-client behavior; done means establishing whether the GoAway is caused by the C# client or the server and documenting actionable guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, grpc
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100