-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Is your feature request related to a problem?
We have a system that uses a recursive protobuf structure to represent some internal data structures.
We want to use GRPC-Java in some more places, but have run into cases where we hit the current recursion limit:
com.google.protobuf.InvalidProtocolBufferException: Protocol message had too many levels of nesting. May be malicious. Use CodedInputStream.setRecursionLimit() to increase the depth limit.
at com.google.protobuf.InvalidProtocolBufferException.recursionLimitExceeded(InvalidProtocolBufferException.java:104)
at com.google.protobuf.CodedInputStream.readMessage(CodedInputStream.java:491)
In the current version of the system, which directly deserializes the protobufs instead of going via GRPC, we set a different recursion limit (say 256) based on stress testing. We know other parts of the system can handle more than 100-deep recursion.
Describe the solution you'd like
We'd like to be able to set CodedInputStream.setRecursionLimit() for a GRPC service. It probably works fine for us if it's at the scope of a server too.
Describe alternatives you've considered
- Using a different RPC stack
- Patching GRPC for our own use
- Refactoring protobufs to avoid nesting (this is quite painful and doesn't really avoid recursion depth issues because other parts of our system will hit limitations on stack size before the protobuf deserialisation).
Additional context
I saw grpc/grpc#8256 and this is basically a duplicate of that, I hope additional context on the use case is helpful.
I'm also open to trying to implement this if there is a chance that the project will accept it.