grpc / grpc-java

The Java gRPC implementation. HTTP/2 based RPC
https://grpc.io/docs/languages/java/
Apache License 2.0
11.46k stars 3.85k forks source link

Is it possible to limit DirectByteBuffer usage? #11642

Open santhoshmanikandan opened 2 weeks ago

santhoshmanikandan commented 2 weeks ago

In case of Server-Side streaming where analytics data is streamed back to client, is it possible to configure the maximum size of buffer that can be used by that RPC call?

Currently I could see that the buffer size keeps on increasing until OOM occurs if client disconnects and server couldn't send back the response. Even though manual flow control is possible for each RPC implementation, looking for an option to tweak it at configuration level or at Interceptor level to make sure such orphaned/rouge RPC calls are discarded in a better way.

kannanjgithub commented 1 day ago

Have you tried adding a cancellation handler on the server (example) to know when to stop sending the streaming response?