zrlw opened a new issue #9283:
URL: https://github.com/apache/dubbo/issues/9283
### Environment
* Dubbo version: 3.0
ReferenceCountExchangeClient的replaceWithLazyClient方法没有判断当前是否正在destroy,创建LazyConnectExchangeClient对象时new
ServiceConfigURL调用可能会NPE,原因是url.getPath()调用InstanceAddressURL#getPath方法时,getProtocolServiceKey()方法因为RpcServiceContext.consumerUrl为null而返回null,传入metadataInfo.getServiceInfo方法入参为null导致ConcurrentHashMap.get调用NPE:
```
java.lang.NullPointerException
at
java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
at
org.apache.dubbo.metadata.MetadataInfo.getServiceInfo(MetadataInfo.java:174)
at
org.apache.dubbo.registry.client.InstanceAddressURL.getPath(InstanceAddressURL.java:133)
at
org.apache.dubbo.rpc.protocol.dubbo.LazyConnectExchangeClient.<init>(LazyConnectExchangeClient.java:65)
at
org.apache.dubbo.rpc.protocol.dubbo.ReferenceCountExchangeClient.replaceWithLazyClient(ReferenceCountExchangeClient.java:217)
at
org.apache.dubbo.rpc.protocol.dubbo.ReferenceCountExchangeClient.closeInternal(ReferenceCountExchangeClient.java:187)
at
org.apache.dubbo.rpc.protocol.dubbo.ReferenceCountExchangeClient.close(ReferenceCountExchangeClient.java:164)
at
org.apache.dubbo.rpc.protocol.dubbo.DubboInvoker.destroyInternal(DubboInvoker.java:174)
at
org.apache.dubbo.rpc.protocol.dubbo.DubboInvoker.destroy(DubboInvoker.java:141)
at
org.apache.dubbo.rpc.listener.ListenerInvokerWrapper.destroy(ListenerInvokerWrapper.java:89)
at org.apache.dubbo.rpc.Invoker.destroyAll(Invoker.java:50)
at
org.apache.dubbo.registry.client.ServiceDiscoveryRegistryDirectory.destroyAllInvokers(ServiceDiscoveryRegistryDirectory.java:344)
at
org.apache.dubbo.registry.integration.DynamicDirectory.destroy(DynamicDirectory.java:297)
at
org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.destroy(AbstractClusterInvoker.java:126)
at
org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.destroy(MockClusterInvoker.java:80)
at
org.apache.dubbo.registry.client.migration.MigrationInvoker.destroy(MigrationInvoker.java:316)
at
org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:72)
at org.apache.dubbo.common.bytecode.proxy4.$destroy(proxy4.java)
at
org.apache.dubbo.config.utils.SimpleReferenceCache.destroyReference(SimpleReferenceCache.java:244)
at
org.apache.dubbo.config.utils.SimpleReferenceCache.lambda$5(SimpleReferenceCache.java:234)
at
java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1597)
at
org.apache.dubbo.config.utils.SimpleReferenceCache.destroyAll(SimpleReferenceCache.java:232)
at
org.apache.dubbo.config.deploy.DefaultModuleDeployer.unreferServices(DefaultModuleDeployer.java:402)
at
org.apache.dubbo.config.deploy.DefaultModuleDeployer.postDestroy(DefaultModuleDeployer.java:205)
at
org.apache.dubbo.rpc.model.ModuleModel.onDestroy(ModuleModel.java:107)
at org.apache.dubbo.rpc.model.ScopeModel.destroy(ScopeModel.java:108)
at
org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onContextClosedEvent(DubboDeployApplicationListener.java:127)
at
org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:100)
at
org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:1)
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:96)
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:335)
at
org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1059)
at
org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1020)
at
org.apache.dubbo.test.spring.SpringXmlConfigTest.test(SpringXmlConfigTest.java:69)
```
--
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]