gRPC channel for target was not shutdown properly

Imagine you are faced with an error like this:

io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference cleanQueue
SEVERE: ~~~ Channel ManagedChannelImpl{logId=*, target=*} was not shutdown properly!!! ~~~
Make sure to call shutdown()/shutdownNow() and wait until awaitTermination() returns true.
java.lang.RuntimeException: ManagedChannel allocation site
at io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference.(
at io.grpc.internal.ManagedChannelOrphanWrapper.(
at io.grpc.internal.ManagedChannelOrphanWrapper.(

The point is that if you create a gRPC channel, you must close it after use. Let’s say you’ve already made a channel like this:

ManagedChannel channel = NettyChannelBuilder.forAddress(host, port)

After use, it will need to be closed. It is important to wait until it closes; awaitTermination() is used for this:

try {
    channel.awaitTermination(5000, TimeUnit.MILLISECONDS);
} catch (InterruptedException ex) {
    log.error("gRPC channel shutdown interrupted");
Telegram channel

If you still have any questions, feel free to ask me in the comments under this article or write me at

If I saved your day, you can support me 🤝

Leave a Reply

Your email address will not be published. Required fields are marked *