zrlw commented on a change in pull request #8683: URL: https://github.com/apache/dubbo/pull/8683#discussion_r704070879
########## File path: dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java ########## @@ -688,7 +693,8 @@ public synchronized void doOverrideIfNecessary() { return; } //The current, may have been merged many times - URL currentUrl = exporter.getInvoker().getUrl(); + Invoker<?> exporterInvoker = exporter.getInvoker(); Review comment: one report of github say NPE occurred at hereļ¼ ``` 2021-09-04T15:32:54.6371279Z [04/09/21 15:32:54:558 UTC] main ERROR zookeeper.ZookeeperRegistry: [DUBBO] Failed to notify addresses for subscribe provider://172.18.64.1:2/org.apache.dubbo.config.api.DemoService?anyhost=true&application=test-reference-retry&bind.ip=172.18.64.1&bind.port=2&category=configurators&check=false&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=org.apache.dubbo.config.api.DemoService&metadata-type=remote&methods=getUsers,sayName,echo,throwDemoException,getBox&monitor=dubbo%3A%2F%2Fmonitor-addr%3A12080%3Fapplication%3Dtest-reference-retry%26dubbo%3D2.0.2%26interface%3Dorg.apache.dubbo.monitor.MonitorService%26pid%3D9096%26register.ip%3D172.18.64.1%26release%3D2.7.14-SNAPSHOT%26tag1%3Dvalue1%26tag2%3Dvalue2%26tag3%3Dvalue3%26timestamp%3D1630769574453&pid=9096&release=2.7.14-SNAPSHOT&service.name=ServiceBean:/org.apache.dubbo.config.api.DemoService&side=provider&tag1=value1&tag2=value2&tag3=value3×tamp=1630769574426, cause: null, dubbo version: 2.7.14-SNAPSHOT, current host: 172.18.64.1 2021-09-04T15:32:54.6376874Z java.lang.NullPointerException 2021-09-04T15:32:54.6378945Z at org.apache.dubbo.registry.integration.RegistryProtocol$OverrideListener.doOverrideIfNecessary(RegistryProtocol.java:691) <=== throw NPE here 2021-09-04T15:32:54.6381863Z at org.apache.dubbo.registry.integration.RegistryProtocol$OverrideListener.notify(RegistryProtocol.java:672) 2021-09-04T15:32:54.6384112Z at org.apache.dubbo.registry.support.AbstractRegistry.notify(AbstractRegistry.java:429) 2021-09-04T15:32:54.6386310Z at org.apache.dubbo.registry.support.FailbackRegistry.doNotify(FailbackRegistry.java:372) 2021-09-04T15:32:54.6388607Z at org.apache.dubbo.registry.support.FailbackRegistry.notify(FailbackRegistry.java:364) 2021-09-04T15:32:54.6390958Z at org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(ZookeeperRegistry.java:181) 2021-09-04T15:32:54.6393129Z at org.apache.dubbo.registry.support.FailbackRegistry.subscribe(FailbackRegistry.java:299) 2021-09-04T15:32:54.6395216Z at org.apache.dubbo.registry.ListenerRegistryWrapper.subscribe(ListenerRegistryWrapper.java:105) 2021-09-04T15:32:54.6397337Z at org.apache.dubbo.registry.integration.RegistryProtocol.export(RegistryProtocol.java:232) 2021-09-04T15:32:54.6399486Z at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.export(ProtocolListenerWrapper.java:62) 2021-09-04T15:32:54.6401638Z at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper.export(ProtocolFilterWrapper.java:73) 2021-09-04T15:32:54.6403164Z at org.apache.dubbo.rpc.Protocol$Adaptive.export(Protocol$Adaptive.java) 2021-09-04T15:32:54.6404748Z at org.apache.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:518) 2021-09-04T15:32:54.6406534Z at org.apache.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:339) 2021-09-04T15:32:54.6408001Z at org.apache.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:314) 2021-09-04T15:32:54.6409401Z at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:238) 2021-09-04T15:32:54.6411194Z at org.apache.dubbo.config.ReferenceConfigTest.testReferenceRetry(ReferenceConfigTest.java:135) ``` org.apache.dubbo.config.ReferenceConfigTest testReferenceRetry() code snippet: ( version: https://github.com/apache/dubbo/pull/7754 ) ``` try { demoService = rc.get(); // line 118: throw RuntimeException here !!! success = true; } catch (Exception e) { e.printStackTrace(); } Assertions.assertFalse(success); Assertions.assertNull(demoService); ServiceConfig<DemoService> sc = new ServiceConfig<DemoService>(); sc.setInterface(DemoService.class); sc.setRef(new DemoServiceImpl()); sc.setApplication(application); sc.setRegistry(registry); sc.setProtocol(protocol); try { System.setProperty("java.net.preferIPv4Stack", "true"); sc.export(); // line 135: throw NPE here !!! demoService = rc.get(); success = true; } catch (Exception e) { e.printStackTrace(); } finally { ``` the reason might be a RuntimeException thrown out of ReferenceConfigTest line 118: ``` 2021-09-04T15:32:54.4747828Z [04/09/21 15:32:54:400 UTC] main WARN integration.DynamicDirectory: [DUBBO] unexpected error when unregister service org.apache.dubbo.config.api.DemoServicefrom registryzookeeper://localhost:36237/org.apache.dubbo.registry.RegistryService?application=test-reference-retry&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=9096&release=2.7.14-SNAPSHOT&tag1=value1&tag2=value2&tag3=value3×tamp=1630769573778, dubbo version: 2.7.14-SNAPSHOT, current host: 172.18.64.1 2021-09-04T15:32:54.4753549Z java.lang.RuntimeException 2021-09-04T15:32:54.4755171Z at org.apache.dubbo.common.function.ThrowableFunction.execute(ThrowableFunction.java:54) 2021-09-04T15:32:54.4760684Z at org.apache.dubbo.common.function.ThrowableFunction.execute(ThrowableFunction.java:69) 2021-09-04T15:32:54.4764242Z at org.apache.dubbo.registry.zookeeper.ZookeeperServiceDiscovery.doInServiceDiscovery(ZookeeperServiceDiscovery.java:190) 2021-09-04T15:32:54.4769705Z at org.apache.dubbo.registry.zookeeper.ZookeeperServiceDiscovery.getServices(ZookeeperServiceDiscovery.java:113) 2021-09-04T15:32:54.4773249Z at org.apache.dubbo.registry.client.EventPublishingServiceDiscovery.getServices(EventPublishingServiceDiscovery.java:192) 2021-09-04T15:32:54.4776688Z at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.isAvailable(ServiceDiscoveryRegistry.java:307) 2021-09-04T15:32:54.4780044Z at org.apache.dubbo.registry.ListenerRegistryWrapper.isAvailable(ListenerRegistryWrapper.java:46) 2021-09-04T15:32:54.4782684Z at org.apache.dubbo.registry.integration.DynamicDirectory.destroy(DynamicDirectory.java:232) 2021-09-04T15:32:54.4785253Z at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.destroy(AbstractClusterInvoker.java:112) 2021-09-04T15:32:54.4787941Z at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$InterceptorInvokerNode.destroy(AbstractCluster.java:118) 2021-09-04T15:32:54.4790714Z at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.destroy(MockClusterInvoker.java:78) 2021-09-04T15:32:54.4793452Z at org.apache.dubbo.registry.client.migration.MigrationInvoker.destroy(MigrationInvoker.java:195) 2021-09-04T15:32:54.4796742Z at org.apache.dubbo.config.ReferenceConfig.checkInvokerAvailable(ReferenceConfig.java:421) 2021-09-04T15:32:54.4799064Z at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:323) 2021-09-04T15:32:54.4800871Z at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:206) 2021-09-04T15:32:54.4803180Z at org.apache.dubbo.config.ReferenceConfigTest.testReferenceRetry(ReferenceConfigTest.java:118) ``` see the whole Unit Test On windows-2019 (JDK: 8) job logs: https://github.com/apache/dubbo/runs/3513846068?check_suite_focus=true -- 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