zrlw edited a comment on pull request #9284:
URL: https://github.com/apache/dubbo/pull/9284#issuecomment-972551432


   this problem is not only occurred at 
ReferenceCountExchangeClient#replaceWithLazyClient.
   there are many RpcContext.getServiceContext().getConsumerUrl().getXXX calls 
in InstanceAddressURL methods, it might cause problem because the lifecyle of 
InstanceAddressURL and RpcContext's thread local are different.
   when scope model is destroying, the thread local SERVICE_CONTEXT of 
RpcContext will be removed first, calling the InstanceAddressURL methods which 
use RpcContext.getServiceContext().getConsumerUrl().getXXX will trigger NPE.
   What makes the matter worse is ExchangeClient will be closed more than once 
by many destroy processes such as applicationContext.close, 
DubboBootstrap.reset()  and so on, under these circumstance, the problem is 
still existed even you remove the thread local of RpcContext at the end of 
destroy process.
   it's might be better to redesign InstanceAddressURL.


-- 
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-unsubscr...@dubbo.apache.org

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



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

Reply via email to