grpc-java
grpc-java copied to clipboard
BinderTransports may report transportTerminated() despite unfinished work in Executors
For example, BinderClientTransport delays transportTerminated() until all in-flight calls complete but it doesn't consider all the work it may have enqueued on all the various Executors. We should either cancel all these tasks or wait for them to complete before declaring the transport terminated. That's because the higher layer ManagedChannel contract implies/says that all these Executors can be shutdown after termination. There are two cases:
ExecutorService#shutdownNow()- our Runnables could be returned fromshutdownNow()without having executed. Callers ofexecutedon't really expect this. I can imagine it could cause a resource leak.ExecutorService#shutdown()- less likely to be a problem.
BinderServerTransport seems to have the same problem.