The util/thread-poolh defines the following method:
This method is called by RPC Close() method.
Notice that it first waits for the queue to drain before shutting down. Nothing is preventing new requests from entering the queue, so it may block forever as long as there is a steady influx of new requests.
Instead the code should prevent any new work from entering the pool and only then wait for existing ones to complete.
Note that the same problem is present in Impala code as well.