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.

Client Error: io.grpc.StatusRuntimeException: UNKNOWN

See original GitHub issue

What version of gRPC are you using?

1.0.2

What JVM are you using (java -version)?

1.8

What did you do?

I am running a gRPC-java server with multiple grpc services defined.

When running multiple stubs and their multiple rpc calls simultaneously I am seeing this exception below thrown.

io.grpc.StatusRuntimeException: UNKNOWN
	at io.grpc.Status.asRuntimeException(Status.java:545)
	at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:395)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:481)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:398)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:513)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
	at io.grpc.internal.SerializingExecutor$TaskRunner.run(SerializingExecutor.java:154)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

This happens only when I have multiple stubs with their own channel defined and the occurrence of the exception seems to be more frequent when increasing the number of stubs/rpc calls. This looks to me like some sort of resource issue either client or server side. I have increased the thread count and seen no measurable improvements. Not sure where to go from here?

My server setup is as follows:

private final NettyServerBuilder builder;
private final NioEventLoopGroup workerGroup;
...
...

// The options are currently set to the defualt grpc settings. So in effect these should not change the default environment.
// NioEventLoopGroup( 2 * Runtime.getRuntime().availableProcessors() )
builder.workerEventLoopGroup( workerGroup )
                              // 1048576
				.flowControlWindow( options.getFlowControlWindow() ) 
                              // Integer.MAX_VALUE
				.maxConcurrentCallsPerConnection( options.getMaxConcurrentCallsPerConnection() )
                              // 8192
				.maxHeaderListSize( options.getMaxHeaderListSize() )
                              // 4 * 1024 * 1024
				.maxMessageSize( options.getMaxMessageSize() )
                              //ProtocolNegotiators.serverPlaintext()
				.protocolNegotiator( options.getProtocolNegotiator() ) 
                              // Executors.newFixedThreadPool(20)
				.executor( executor )
                              // CompressorRegistry.getDefaultInstance()
				.compressorRegistry( options.getCompressorRegistry() )
                               // DecompressorRegistry.getDefaultInstance()
				.decompressorRegistry( options.getDecompressorRegistry() );

My Client setup:

ManagedChannel channel = NettyChannelBuilder.forAddress( remote_host, remote_port )
				.usePlaintext( true )
				.build();

Runtime.getRuntime().addShutdownHook( new Thread( new Runnable() {
			@Override
			public void run() {
				channel.shutdown();
				try {
					channel.awaitTermination( 120, TimeUnit.SECONDS );
				} catch ( InterruptedException e ) {
					Thread.currentThread().interrupt();
				}
			}
		} ) );

CallOptions callOptions = CallOptions.DEFAULT.withCompression( "gzip" );
// Where stubClazz would be the grpc-proto stub
Constructor<Stub> constructor = stubClazz.getDeclaredConstructor( Channel.class,
				CallOptions.class );
constructor.setAccessible( true );
return constructor.newInstance( channel, callOptions );

What did you expect to see?

I expect to get back the response object.

What did you see instead?

Instead I received a io.grpc.StatusRuntimeException: UNKNOWN

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ejona86commented, Jan 21, 2017

The server probably threw an exception. The exception information is not safe to propagate to the client by default, so you get a useless error on client-side. Did you check the server logs to see if there were any uncaught exceptions?

0reactions
wrightmcommented, Jan 23, 2017

@ejona86 apologies typo, that sorts out the unsupported message type: Object (expected: ByteBuf, FileRegion) exception. Thank you.

And also looks like it was the server throwing an exception like you said. However, grpc is not logging this to my file appender with my current logging configuration. Using log4J, I can now look into why this is the case.

Good old sql util Date conflict… There isn’t a Date.toInstant in sql.Date just a java.lang.UnsupportedOperationException, there was me thinking java 8 sorted things like this out. I guess it make sense since sql.Date only support date, month, and year.

Read more comments on GitHub >

github_iconTop Results From Across the Web

grpc - StatusRuntimeException: UNKNOWN caused by ...
We are seeing these errors on the client side sporadically. Caused by: io.grpc.StatusRuntimeException: UNKNOWN: channel closed at io.grpc.
Read more >
o.grpc.StatusRuntimeException: UNKNOWN - Zeebe Client
I have checked grpc side and their replay is as follows: “It sounds like the server returned UNKNOWN with no additional information. If...
Read more >
io.grpc.StatusRuntimeException: UNKNOWN: shard closed
This error is returned to the client if request reaches history node when that node is shutting down (during deployment/redeployment, for ...
Read more >
grpc-java throwing unavailable exception after ~2 billion ...
I'm happy to create a github issue if this can be seen as a bug and not a ... io.grpc.StatusRuntimeException: UNAVAILABLE: Stream IDs...
Read more >
Java Code Examples for io.grpc.Status#UNKNOWN
OK; } else if (error instanceof StatusRuntimeException) { status = ((StatusRuntimeException) error).getStatus(); } else { status = Status.UNKNOWN ...
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