twitter / finagle

A fault tolerant, protocol-agnostic RPC system
https://twitter.github.io/finagle
Apache License 2.0
8.78k stars 1.45k forks source link

How to limit the finagle/RPC's max request size #961

Closed wangyy2113 closed 10 months ago

wangyy2113 commented 10 months ago

OOM when request size too large, exception stack likes

VM error: Java heap space java.lang.OutOfMemoryError: Java heap space at org.apache.thrift.protocol.TBinaryProtocol.readStringBody(TBinaryProtocol.java:379) at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:230) at com.twitter.finagle.thrift.TTwitterServerFilter.apply(TTwitterServerFilter.scala:87) at com.twitter.finagle.thrift.TTwitterServerFilter.apply(TTwitterServerFilter.scala:11) at com.twitter.finagle.Filter$$anon$1.apply(Filter.scala:70) at com.twitter.finagle.Service$$anon$2.apply(Service.scala:16) ...

I want to find a config to limit the request byte size. It will throw RuntimeException when readStringBody meet a large size rather than OOM

anybody can help?

wangyy2113 commented 10 months ago

I found