wongoo commented on issue #8172: URL: https://github.com/apache/dubbo/issues/8172#issuecomment-871054610
https://github.com/apache/dubbo/blob/e8eeddbf42952e7dd4ba4428548f91006900ea5c/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvoker.java#L107 ```java ExecutorService executor = getCallbackExecutor(getUrl(), inv); // 这里consumer 获得的是共享线程池 CompletableFuture<AppResponse> appResponseFuture = currentClient.request(inv, timeout, executor).thenApply(obj -> (AppResponse) obj); // 线程池传递给 DefaultFuture ``` https://github.com/apache/dubbo/blob/e8eeddbf42952e7dd4ba4428548f91006900ea5c/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java#L147 ```java ExecutorService futureExecutor = future.getExecutor(); if (futureExecutor != null && !futureExecutor.isTerminated()) { futureExecutor.shutdownNow(); // 但channel关闭时,也会将线程池关掉,后面的请求就无法处理了 } ``` 线程栈: ``` ts=2021-06-30 10:15:23;thread_name=DubboClientHandler-thread-85;id=180;is_daemon=true;priority=5;TCCL=org.springframework.boot.loader.LaunchedURLClassLoader@7487b142 @java.util.concurrent.ThreadPoolExecutor.shutdownNow() at org.apache.dubbo.remoting.exchange.support.DefaultFuture.closeChannel(DefaultFuture.java:147) at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.disconnected(HeaderExchangeHandler.java:134) at org.apache.dubbo.remoting.transport.AbstractChannelHandlerDelegate.disconnected(AbstractChannelHandlerDelegate.java:48) at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:73) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:41) at java.lang.Thread.run(Thread.java:745) ``` ref: #7109 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
