You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/15 13:39:04 UTC

[GitHub] [dubbo] zrlw edited a comment on issue #8805: [3.0] 近期集成构建结束前,DubboShutdownHook线程经常抛IllegalStateException异常:Shutdown in progress

zrlw edited a comment on issue #8805:
URL: https://github.com/apache/dubbo/issues/8805#issuecomment-919741212


   更新:ReferenceCountExchangeClient的replaceWithLazyClient问题另外开issue了。
   
   ```
   2021-09-15T03:06:39.5666317Z [15/09/21 03:06:36:036 UTC] DubboShutdownHook  WARN dubbo.ReferenceCountExchangeClient:  [DUBBO] 192.168.16.2:20880 org.apache.dubbo.samples.annotation.api.HelloService:1.0.0_annotation safe guard client , should not be called ,must have a bug., dubbo version: 3.0.3-SNAPSHOT, current host: 192.168.16.3
   ```
   搜了一下safe guard client , should not be called ,must have a bug的代码有两处,一处是LazyConnectExchangeClient的warning
   私有方法,由LazyConnectExchangeClient的request方法调起(感觉不应该是这里):
   warning方法注解说warn once every 5000 invocations,但是第一次调用就会warning,因为0模多少都还是0:
   ```
               if (warningcount.get() % warning_period == 0) {
                   logger.warn(url.getAddress() + " " + url.getServiceKey() + " safe guard client , should not be called ,must have a bug.");
               }
               warningcount.incrementAndGet();
   ```
   另一处是ReferenceCountExchangeClient的replaceWithLazyClient,这个代码由close方法触发,这一处是日志告警的位置(日志有显示类名: WARN dubbo.ReferenceCountExchangeClient)。
   ```
           if (disconnectCount.getAndIncrement() % maxDisconnectCount == 0) {
               logger.warn(url.getAddress() + " " + url.getServiceKey() + " safe guard client , should not be called ,must have a bug.");
           }
   ```
   此处和LazyConnectExchangeClient的warning方法一样,也存在第一次就warning的问题;此外replaceWithLazyClient方法的lazyUrl赋值语句靠前了,挪到后面可能合适一点:
   ```
           if (!(client instanceof LazyConnectExchangeClient) || client.isClosed()) {
               URL lazyUrl = url.addParameter(...); <=== 搁到这里就好
               client = new LazyConnectExchangeClient(lazyUrl, client.getExchangeHandler());
           }
   ```


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org