vonox7
09/01/2026, 1:41 PMRESOURCE_EXHAUSTED: gRPC message exceeds maximum size 4194304
GrpcServer { } / GrpcServerConfiguration doesn't expose maxInboundMessageSize, and `GrpcServerImpl`'s constructor is internal, so we can't pass a configured ServerBuilder.
Is there a supported way to set the max grpc size? Would it make sense to just expose the ServerBuilder?
Or would github.com/Kotlin/kotlinx-rpc/pull/754 be the official fix for this, and I'm just a few weeks ahead of train?
I'll put my current workaround in the thread 🧵.vonox7
09/01/2026, 1:42 PMServerProvider that wraps NettyServerBuilder and sets maxInboundMessageSize, registered via META-INF/services/io.grpc.ServerProvider with priority 10 so it wins over grpc-netty (5). kotlinx-rpc still calls ServerBuilder.forPort(port), so the limit applies.
kotlin
class LargeMessageServerProvider : ServerProvider() {
override fun isAvailable(): Boolean = true
override fun priority(): Int = 10
override fun builderForPort(port: Int): ServerBuilder<*> =
NettyServerBuilder.forPort(port)
.maxInboundMessageSize(64 * 1024 * 1024)
override fun newServerBuilderForPort(
port: Int,
credentials: ServerCredentials,
): NewServerBuilderResult =
try {
NewServerBuilderResult.serverBuilder(
NettyServerBuilder.forPort(port, credentials)
.maxInboundMessageSize(64 * 1024 * 1024),
)
} catch (e: IllegalArgumentException) {
NewServerBuilderResult.error(e.message ?: "Unsupported ServerCredentials")
}
}
Downside: this is process-wide for every ServerBuilder.forPort / newServerBuilderForPort in the JVM, not just the kotlinx-rpc servers. Happy to switch to GrpcServer { maxInboundMessageSize = … } as soon as that’s released.Alexander Sysoev
09/01/2026, 1:43 PM