Skip to content

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

@marx-freedom

Description

@marx-freedom

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions