question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

maxInboundMessageSize is not applied when app code has newer gRPC version than used in library

See original GitHub issue

What 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

  1. 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;
  }
}

  1. 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));
  }
}
  1. Run compiled Client with gRPC 1.39.0 in the classpath. The program will print 4194304 but value 100 expected.

It seems this behavior was caused by fixing issue #7552

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ejona86commented, Jul 14, 2021

BTW, @marx-freedom, good job tracking the issue down to the clear reproduction steps. I’m sure it was very confusing.

1reaction
sergiitkcommented, Oct 15, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found