What version of gRPC-Java are you using?
master/HEAD on any version of Android
What did you expect to see?
Some reasoning/guarantee that a BinderServerTransport will no longer call into its SecurityPolicy after it declares termination.
Steps to reproduce the bug
One of many ways is to call call shutdownNow() while it's processing the first call to one of its services.
Analysis
BinderServerTransport has this problem when using either AsyncSecurityPolicy or ordinary SecurityPolicy. It checks these policies from the BinderTransportSecurity.ServerAuthInterceptor which runs on the server's executor() without coordination or synchronization with the transport. A call to shutdownInternal() w/forceTerminate=true can move the transport to SHUTDOWN_TERMINATED and call ServerTransportListener#transportTerminated with streams still in-flight.
What version of gRPC-Java are you using?
master/HEAD on any version of Android
What did you expect to see?
Some reasoning/guarantee that a
BinderServerTransportwill no longer call into its SecurityPolicy after it declares termination.Steps to reproduce the bug
One of many ways is to call call
shutdownNow()while it's processing the first call to one of its services.Analysis
BinderServerTransporthas this problem when using eitherAsyncSecurityPolicyor ordinarySecurityPolicy. It checks these policies from theBinderTransportSecurity.ServerAuthInterceptorwhich runs on the server'sexecutor()without coordination or synchronization with the transport. A call toshutdownInternal()w/forceTerminate=truecan move the transport toSHUTDOWN_TERMINATEDand callServerTransportListener#transportTerminatedwith streams still in-flight.