leojames opened a new issue #9735:
URL: https://github.com/apache/dubbo/issues/9735
### Environment
* Dubbo version: 2.0.2
* Operating System version: Linux Centos
* Java version: 1.8
### Steps to reproduce this issue
1.在系统发布过程中,Dubbo会不断调用org.apache.dubbo.registry.integration.RegistryProtocol#reExport(org.apache.dubbo.rpc.Invoker<T>,
org.apache.dubbo.common.URL)方法,在org.apache.dubbo.registry.integration.RegistryProtocol#getStatedUrl
` private ProviderModel.RegisterStatedURL getStatedUrl(URL registryUrl,
URL providerUrl) {
ProviderModel providerModel = ApplicationModel.getServiceRepository()
.lookupExportedService(providerUrl.getServiceKey());
List<ProviderModel.RegisterStatedURL> statedUrls =
providerModel.getStatedUrl();
return statedUrls.stream()
.filter(u -> u.getRegistryUrl().equals(registryUrl)
&&
u.getProviderUrl().getProtocol().equals(providerUrl.getProtocol()))
.findFirst().orElseThrow(() -> new
IllegalStateException("There should have at least one registered url."));
}`
finFirst中会操作stateUrl这个列表,这个列表又会在注册时候更改
` public void register(URL originUrl, URL registryUrl, URL
registeredProviderUrl) {
Registry registry = registryFactory.getRegistry(registryUrl);
List<RegisterListener> registerListeners =
ExtensionLoader.getExtensionLoader(RegisterListener.class)
.getActivateExtension(originUrl, REGISTER_LISTENER_KEY);
preRegister(registry, registeredProviderUrl, registerListeners);
registry.register(registeredProviderUrl);
postRegister(registry, registeredProviderUrl, registerListeners);
ProviderModel model =
ApplicationModel.getProviderModel(registeredProviderUrl.getServiceKey());
model.addStatedUrl(new ProviderModel.RegisterStatedURL(
registeredProviderUrl,
registryUrl,
true
));
}`
最终导致运行时修改错误,把org.apache.dubbo.rpc.model.ProviderModel 这个List 改为private final
CopyOnWriteArrayList<RegisterStatedURL> urls;
### Expected Behavior
### Actual Behavior
java.util.ConcurrentModificationException
```
ERROR 2022-03-02 21:58:22 [DUBBO] Failed to notify for subscribe
provider://10.1.12.18:20085/com.xxx.api.biz.Remote?.knell_id=33&anyhost=true&application=h_qt&bind.ip=10.1.1.1&bind.port=20085&category=configurators&check=false&deprecated=false&dubbo=2.0.2&dynamic=true&executes=500&generic=false&interface=com.xxx.api.biz.Remote&methods=query&payload=50000000&pid=185&qapp=h_q&release=4.0.63&retries=1&revision=1.1.164&side=provider×tamp=1646229502066&token=false&transporter=netty4&version=1.0,
waiting for retry, cause: null, dubbo version: 4.0.63, current host: 10.1.1.11
java.util.ConcurrentModificationException
at
java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1363)
at
java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at
java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
at
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at
java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at
org.apache.dubbo.registry.integration.RegistryProtocol.getStatedUrl(RegistryProtocol.java:315)
at
org.apache.dubbo.registry.integration.RegistryProtocol.reExport(RegistryProtocol.java:301)
at
org.apache.dubbo.registry.integration.RegistryProtocol$OverrideListener.doOverrideIfNecessary(RegistryProtocol.java:635)
at
org.apache.dubbo.registry.integration.RegistryProtocol$OverrideListener.notify(RegistryProtocol.java:607)
at
org.apache.dubbo.registry.support.AbstractRegistry.doNotify(AbstractRegistry.java:641)
at
org.apache.dubbo.registry.support.AbstractRegistry.notify(AbstractRegistry.java:591)
at
org.apache.dubbo.registry.support.FailbackRegistry.doNotify(FailbackRegistry.java:422)
at
org.apache.dubbo.registry.support.FailbackRegistry.notify(FailbackRegistry.java:413)
at
org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.lambda$null$5(ZookeeperRegistry.java:260)
at
org.apache.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient$CuratorWatcherImpl.process(CuratorZookeeperClient.java:305)
at
qunar.tc.internal.shaded.curator4.org.apache.curator.framework.imps.NamespaceWatcher.process(NamespaceWatcher.java:83)
at
org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:522)
at
org.apache.zookeeper.ClientCnxn$EventThread.run$original$Np4QRXnF(ClientCnxn.java:498)
at
org.apache.zookeeper.ClientCnxn$EventThread.run$original$Np4QRXnF$accessor$inzGLrMJ(ClientCnxn.java)
at
org.apache.zookeeper.ClientCnxn$EventThread$auxiliary$fPSHJ5jE.call(Unknown
Source)
at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java)
```
--
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]