FutureStub hangs when wrong netty version is used
See original GitHub issuePlease answer these questions before submitting your issue.
What version of gRPC are you using?
1.3.0
What JVM are you using (java -version
)?
netty4.version
What did you do?
If possible, provide a recipe for reproducing the error.
- Accidentally use netty-codec-http2 4.1.9.Final in your pom
- Create a future stub
- Call
stub.someOperation().get()
What did you expect to see?
- The call should fail from the underlying
ClassNotFoundException
What did you see instead?
- A log message is printed to the console indicating the
ClassNotFoundException
- The call to
.get()
blocks indefinitely because the underlying future never returns - If a timeout is used when calling
.get()
, the request always times out
This problem was especially hard to diagnose because our logger is configured to exclude log messages from libraries (legacy code), so the ClassNotFoundException
was never surfaced.
Findings
ChannelExecutor.drain()
(line 89) eats all exceptions thrown when processing the outbound task queue whenDelayedClientTransport
switches fromDelayedStream
toNettyClientStream
inDelayedClientTransport.newStream()
.GrpcHttp2HeadersDecoder.<init>
fails with aClassNotFoundException
when trying to loadio.netty.handler.codec.http2.internal.hpack.Decoder
.- Since the stream switch is itself is the task that fails,
DelayedClientTransport
buffers outbound tasks indefinitely, causing the request to hang.
Possible Mitigations
- Propagate exceptions from
ChannelExecutor.drain()
in a “CompositeException” that aggregates all exceptions encountered. This will cause the client to explode, rather than logging and hoping someone is watching. - Fail conspicuously when starting gRPC with an incompatible netty version.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
Trouble-Shooting | grpc-spring-boot-starter - GitHub Pages
The server/client does not start because some class or method is missing. This is usually the case if the grpc-libraries use slightly different...
Read more >JVM crashes while authenticating pub/sub - Stack Overflow
The issue disappears if you disable Netty's native support or if you use an image that has glibc, e.g.: azul/zulu-openjdk-alpine:11-jre ...
Read more >Downloads - Netty
Downloads. Netty is distributed under Apache License, v2.0. Please see the enclosed NOTICE.txt for more information. netty-5.0.0.Alpha5.tar.gz ‐ 28-Sep-2022 ...
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
You should feel pretty good that the future will be resolved as long as no panic-level errors occur.
Should be about the same.
It’s possible by making your own ClientCall.Listener (extending ForwardingClientCallListener).
This is to be resolved by #4023