maxInboundMessageSize is not applied when app code has newer gRPC version than used in library
See original GitHub issueWhat version of gRPC-Java are you using?
Library compiled with gRPC 1.26.0 (cannot be recompiled on demand) Application must use a newer version (>= 1.34), gRPC 1.39.0
What is your environment?
Linux, OpenJDK 15
What did you expect to see?
Custom maxInboundMessageSize value (!= 4 MiB) is applied and works correctly
What did you see instead?
Status{code=CLIENT_RESOURCE_EXHAUSTED, issues=[gRPC error: (RESOURCE_EXHAUSTED) gRPC message exceeds maximum size 4194304: 14995791 (S_ERROR)]}
Steps to reproduce the bug
- Compile library code with gRPC 1.26.0
import io.grpc.ManagedChannelBuilder;
import io.grpc.netty.NettyChannelBuilder;
public class Lib {
private final NettyChannelBuilder ncb;
public Lib() {
ncb = NettyChannelBuilder
.forTarget("localhost:100")
.maxInboundMessageSize(100);
}
public NettyChannelBuilder getBuilder() {
return ncb;
}
}
- Compile application, using the compiled library, with gRPC 1.39.0
import java.lang.reflect.Field;
import io.grpc.netty.NettyChannelBuilder;
import io.grpc.internal.AbstractManagedChannelImplBuilder;
public class Client {
public static void main(String[] args) throws Exception {
NettyChannelBuilder ncb = new Lib().getBuilder();
// reflection is used to create a minimal example showing the problem -
// no need to create a real channel, start the server, etc.
Field f = ncb.getClass().getDeclaredField("maxInboundMessageSize");
f.setAccessible(true);
System.out.println(f.get(ncb));
}
}
- Run compiled
Client
with gRPC 1.39.0 in the classpath. The program will print4194304
but value100
expected.
It seems this behavior was caused by fixing issue #7552
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top Results From Across the Web
ManagedChannelBuilder (grpc-all 1.51.0 API)
Provides a custom executor. It's an optional parameter. If the user has not provided an executor when the channel is built, the builder...
Read more >gRPC-Swift on CocoaPods.org
This repository contains a gRPC Swift API and code generator. It is intended for use with Apple's SwiftProtobuf support for Protocol Buffers.
Read more >Static Configuration — Daml SDK 2.0.1-snapshot ...
Static Configuration¶. Canton differentiates between static and dynamic configuration. Static configuration is immutable and therefore has to be known from ...
Read more >grpc/grpc - Gitter
Hello, I have implemented grpc.lb.v1.load_balancer.proto, however my client can't connect it. To test load balancer, I am using a simple python client:
Read more >Client libraries explained | Cloud APIs
Google API Client Libraries · Provide access to the API's REST interface only; gRPC is not supported. · Have autogenerated interface code that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
BTW, @marx-freedom, good job tracking the issue down to the clear reproduction steps. I’m sure it was very confusing.
Hey @marx-freedom! Good news, I tracked down exact root causes, and fixed the issue. After the fix is released, and you update your application code,
maxInboundMessageSize(int)
will be working correctly.