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/04 04:15:17 UTC

[GitHub] [dubbo] zrlw opened a new issue #8675: [3.0] 单元测试AfterEach调用DubboBootstrap.reset()的问题

zrlw opened a new issue #8675:
URL: https://github.com/apache/dubbo/issues/8675


   ### Environment
   
   * Dubbo version: 3.0
   在AfterEach里调用DubboBootstrap.reset(),存在一定概率触发spring的AbstractDirtiesContextTestExecutionListener抛异常,导致CI集成构建失败。
   
   ### Steps to reproduce this issue
   比如GenericServiceTest的testGeneric测试类,跑CI时偶尔会抛IllegalStateException:
   org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - After test method: context [DefaultTestContext@3332c7a5 testClass = GenericServiceTest, testInstance = org.apache.dubbo.config.spring.schema.GenericServiceTest@340c7479, testMethod = testGeneric@GenericServiceTest, testException = java.lang.IllegalStateException: Failed to check the status of the service org.apache.dubbo.config.spring.api.LocalMissClass. No provider available for the service org.apache.dubbo.config.spring.api.LocalMissClass from the url dubbo://10.1.0.184/org.apache.dubbo.config.spring.api.LocalMissClass?application=dubbo-generic-consumer&dubbo=2.0.2&file.cache=false&generic=true&init=false&interface=org.apache.dubbo.config.spring.api.LocalMissClass&metadata-type=remote&pid=9816&register.ip=10.1.0.184&release=3.0.3-SNAPSHOT&side=consumer&sticky=false&timestamp=1630699707283 to the consumer 10.1.0.184 use dubbo version 3.0.3-SNAPSHOT, mergedContextConfiguration = [MergedContextCo
 nfiguration@2accaec2 testClass = GenericServiceTest, locations = '{}', classes = '{class org.apache.dubbo.config.spring.schema.GenericServiceTest}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@67e25252, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@72bdd7c7, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@696db620], contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]], attributes = map[[empty]]], class annotated with @DirtiesContext [true] with mode [AFTER_EACH_TEST_METHOD], 
 method annotated with @DirtiesContext [false] with mode [null].   
   


-- 
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


[GitHub] [dubbo] EarthChen commented on issue #8675: [3.0] 单元测试org.apache.dubbo.config.spring.schema.GenericServiceTest的问题

Posted by GitBox <gi...@apache.org>.
EarthChen commented on issue #8675:
URL: https://github.com/apache/dubbo/issues/8675#issuecomment-912949195


   Have you found any rules that can help?


-- 
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


[GitHub] [dubbo] zrlw edited a comment on issue #8675: [3.0] 单元测试org.apache.dubbo.config.spring.schema.GenericServiceTest的问题

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #8675:
URL: https://github.com/apache/dubbo/issues/8675#issuecomment-914280700


   看了一下3.0的RegistryDirectory,isAvailable和refreshInvoker也存在同样的问题啊,local reference不该这么用的吧,
   两个方法都去local reference引用urlInvokerMap这个集合,main线程执行isAvailable方法检查local reference的集合是否为空、不为空则进行遍历的时候,main-eventThread线程执行refreshInvoker对local reference的集合里面的entry直接进行remove,合适么?
   相比master分支的代码,感觉这两个类的优化代码考虑欠周全,毁掉了多线程互斥操作的基础。


-- 
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


[GitHub] [dubbo] zrlw commented on issue #8675: [3.0] 单元测试org.apache.dubbo.config.spring.schema.GenericServiceTest的问题

Posted by GitBox <gi...@apache.org>.
zrlw commented on issue #8675:
URL: https://github.com/apache/dubbo/issues/8675#issuecomment-913098640


   从github构建日志看,genericServiceWithoutInterface.$invoke这个ReferenceBean是lazy initializing: 
   ```
   2021-09-04T20:19:48.3314340Z 20:19:47.115 [main] DEBUG org.apache.dubbo.config.spring.ReferenceBean$DubboReferenceLazyInitTargetSource - Initializing lazy target object
   ```
   也就是说单元测试执行到下面这条语句时才会创建这个ReferenceBean:
   ```
   result = genericServiceWithoutInterfaceRef.$invoke("sayHello", new String[]{"java.lang.String"}, new Object[]{"generic"});
   ```
   但是ReferenceConfig的init方法最后要调用checkInvokerAvailable去检查invoker连接是否已经ok,节奏是不是有点太快了,延迟初始化的ReferenceBean刚完成构建,相关的连接立马就ok?
   github日志显示100ms后,mian线程收到一个null应答后就开始Unsubscribe了:
   ```
   2021-09-04T20:19:48.3751852Z 20:19:47.246 [main-SendThread(MiningMadness.com:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x10000493ad40000, packet:: clientPath:null serverPath:null finished:false header:: 147,2  replyHeader:: 147,41,0  request:: '/dubbo/org.apache.dubbo.config.spring.api.LocalMissClass/consumers/dubbo%253A%252F%252F172.17.16.1%252Forg.apache.dubbo.config.spring.api.LocalMissClass%253Fapplication%253Ddubbo-generic-consumer%2526category%253Dconsumers%2526check%253Dfalse%2526dubbo%253D2.0.2%2526file.cache%253Dfalse%2526generic%253Dtrue%2526init%253Dfalse%2526interface%253Dorg.apache.dubbo.config.spring.api.LocalMissClass%2526metadata-type%253Dremote%2526pid%253D6992%2526release%253D3.0.3-SNAPSHOT%2526side%253Dconsumer%2526sticky%253Dfalse%2526timestamp%253D1630786787116,-1  response:: null
   2021-09-04T20:19:48.3759385Z [04/09/21 20:19:47:247 UTC] main  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Unsubscribe: dubbo://172.17.16.1/org.apache.dubbo.config.spring.api.LocalMissClass?application=dubbo-generic-consumer&category=providers,configurators,routers&dubbo=2.0.2&file.cache=false&generic=true&init=false&interface=org.apache.dubbo.config.spring.api.LocalMissClass&metadata-type=remote&pid=6992&release=3.0.3-SNAPSHOT&side=consumer&sticky=false&timestamp=1630786787116, dubbo version: 3.0.3-SNAPSHOT, current host: 172.17.16.1
   ```
   完整日志见:
   https://github.com/apache/dubbo/runs/3514650085?check_suite_focus=true  点设置里的download log archive,下载后打开里面的 4_Unit Test On windows-2019 (JDK 11).txt,文件很大,记事本打不开或者龟速,需要用notepad++之类的大文件编辑工具看。


-- 
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


[GitHub] [dubbo] zrlw commented on issue #8675: [3.0] 单元测试org.apache.dubbo.config.spring.schema.GenericServiceTest的问题

Posted by GitBox <gi...@apache.org>.
zrlw commented on issue #8675:
URL: https://github.com/apache/dubbo/issues/8675#issuecomment-914280700


   看了一下3.0的RegistryDirectory,isAvailable和refreshInvoker也存在同样的问题啊,弱引用不该这么用的吧,
   两个方法都去弱引用urlInvokerMap这个集合,main线程执行isAvailable方法检查弱引用集合是否为空、不为空则进行遍历的时候,main-eventThread线程执行refreshInvoker对弱引用集合里面的entry直接进行remove,合适么?


-- 
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


[GitHub] [dubbo] zrlw edited a comment on issue #8675: [3.0] 单元测试org.apache.dubbo.config.spring.schema.GenericServiceTest的问题

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #8675:
URL: https://github.com/apache/dubbo/issues/8675#issuecomment-913780054


   前面92行的demoServiceRef.$invoke调用成功说明网络没有问题,日志里没有netty连接断开的信息,这两个Reference用的是一个长连接。
   跟踪了一下checkInvokerAvailable,调用的是ServiceDiscoveryRegistryDirectory的isAvailable方法:
   ```
       public boolean isAvailable() {
           if (isDestroyed()) {
               return false; <== 如果已经destroyed,则会触发Failed to check the status
           }
           Map<String, Invoker<T>> localUrlInvokerMap = urlInvokerMap;  <== 这个如果为空,那么也会触发
           if (localUrlInvokerMap != null && localUrlInvokerMap.size() > 0) {
               for (Invoker<T> invoker : new ArrayList<>(localUrlInvokerMap.values())) {
                   if (invoker.isAvailable()) {
                       return true;
                   }
               }
           }
           return false;
       }
   ```
   日志里没看到和destroy相关的信息,怀疑urlInvokerMap这个东西是空导致的问题,看了代码,这个东西是refreshInvoker刷进来的,跟踪了一下,貌似刷新的线程和执行ReferenceConfig的init方法的线程不是一个,刷新的线程名是main-EventThread,执行init的线程是main线程。跟进去refreshInvoker方法,发现这个方法调用toInvokers先把当前的urlInvokerMap里面的内容全清掉,在this.urlInvokerMap = newUrlInvokerMap重新赋值前,如果执行init的main线程去执行isAvailable就会返回false,debug在toInvokers方法后暂停main-EventThread线程继续执行,这个异常就能重现。
   做了个PR,才发现最新3.0分支的GenericServiceTest拆成了两个测试类,分拆之后原来的代码出异常的概率可能就小了。
   不过找了三天终于找到原因了还是很开心。


-- 
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


[GitHub] [dubbo] zrlw edited a comment on issue #8675: [3.0] 单元测试org.apache.dubbo.config.spring.schema.GenericServiceTest的问题

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #8675:
URL: https://github.com/apache/dubbo/issues/8675#issuecomment-913098640


   从github构建日志看,genericServiceWithoutInterface.$invoke这个ReferenceBean是lazy initializing: 
   ```
   2021-09-04T20:19:48.3314340Z 20:19:47.115 [main] DEBUG org.apache.dubbo.config.spring.ReferenceBean$DubboReferenceLazyInitTargetSource - Initializing lazy target object
   ```
   也就是说单元测试执行到下面这条语句时才会创建这个ReferenceConfig:
   ```
   result = genericServiceWithoutInterfaceRef.$invoke("sayHello", new String[]{"java.lang.String"}, new Object[]{"generic"});
   ```
   ReferenceConfig的init方法最后调用checkInvokerAvailable检查invoker连接是否已经ok。
   github日志显示130ms后,main线程就开始Unsubscribe操作了,这时候checkInvokerAvailable应该是抛异常了:
   ```
   2021-09-04T20:19:48.3751852Z 20:19:47.246 [main-SendThread(MiningMadness.com:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x10000493ad40000, packet:: clientPath:null serverPath:null finished:false header:: 147,2  replyHeader:: 147,41,0  request:: '/dubbo/org.apache.dubbo.config.spring.api.LocalMissClass/consumers/dubbo%253A%252F%252F172.17.16.1%252Forg.apache.dubbo.config.spring.api.LocalMissClass%253Fapplication%253Ddubbo-generic-consumer%2526category%253Dconsumers%2526check%253Dfalse%2526dubbo%253D2.0.2%2526file.cache%253Dfalse%2526generic%253Dtrue%2526init%253Dfalse%2526interface%253Dorg.apache.dubbo.config.spring.api.LocalMissClass%2526metadata-type%253Dremote%2526pid%253D6992%2526release%253D3.0.3-SNAPSHOT%2526side%253Dconsumer%2526sticky%253Dfalse%2526timestamp%253D1630786787116,-1  response:: null
   2021-09-04T20:19:48.3759385Z [04/09/21 20:19:47:247 UTC] main  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Unsubscribe: dubbo://172.17.16.1/org.apache.dubbo.config.spring.api.LocalMissClass?application=dubbo-generic-consumer&category=providers,configurators,routers&dubbo=2.0.2&file.cache=false&generic=true&init=false&interface=org.apache.dubbo.config.spring.api.LocalMissClass&metadata-type=remote&pid=6992&release=3.0.3-SNAPSHOT&side=consumer&sticky=false&timestamp=1630786787116, dubbo version: 3.0.3-SNAPSHOT, current host: 172.17.16.1
   ```
   完整日志见:
   https://github.com/apache/dubbo/runs/3514650085?check_suite_focus=true  点设置里的download log archive,下载后打开里面的 4_Unit Test On windows-2019 (JDK 11).txt,文件很大,记事本打不开或者龟速,需要用notepad++之类的大文件编辑工具看。


-- 
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


[GitHub] [dubbo] AlbumenJ closed issue #8675: [3.0] ServiceDiscoveryRegistryDirectory的refreshInvoker方法和isAvailable存在并行执行冲突

Posted by GitBox <gi...@apache.org>.
AlbumenJ closed issue #8675:
URL: https://github.com/apache/dubbo/issues/8675


   


-- 
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


[GitHub] [dubbo] zrlw commented on issue #8675: [3.0] 单元测试org.apache.dubbo.config.spring.schema.GenericServiceTest的问题

Posted by GitBox <gi...@apache.org>.
zrlw commented on issue #8675:
URL: https://github.com/apache/dubbo/issues/8675#issuecomment-913461946


   今天几个PR触发的构建失败日志,发现里面也有
   GenericServiceTest.testGeneric:97 » IllegalState Failed to check the status of...


-- 
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


[GitHub] [dubbo] zrlw edited a comment on issue #8675: [3.0] 单元测试org.apache.dubbo.config.spring.schema.GenericServiceTest的问题

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #8675:
URL: https://github.com/apache/dubbo/issues/8675#issuecomment-913780054


   前面92行的demoServiceRef.$invoke调用成功说明网络没有问题,日志里没有netty连接断开的信息,这两个Reference用的是一个长连接。
   跟踪了一下checkInvokerAvailable,调用的是ServiceDiscoveryRegistryDirectory的isAvailable方法:
   ```
       public boolean isAvailable() {
           if (isDestroyed()) {
               return false; <== 如果已经destroyed,则会触发Failed to check the status
           }
           Map<String, Invoker<T>> localUrlInvokerMap = urlInvokerMap;  <== 这个如果为空,那么也会触发
           if (localUrlInvokerMap != null && localUrlInvokerMap.size() > 0) {
               for (Invoker<T> invoker : new ArrayList<>(localUrlInvokerMap.values())) {
                   if (invoker.isAvailable()) {
                       return true;
                   }
               }
           }
           return false;
       }
   ```
   日志里没看到和destroy相关的信息,怀疑urlInvokerMap这个东西是空导致的问题,看了代码,这个东西是refreshInvoker刷进来的,跟踪了一下,貌似刷新的线程和执行ReferenceConfig的init方法的线程不是一个,刷新的线程名是main-EventThread,执行init的线程是main线程。跟进去refreshInvoker方法,发现这个方法调用toInvokers先把当前的urlInvokerMap里面的内容全清掉,在this.urlInvokerMap = newUrlInvokerMap重新赋值前,如果执行init的main线程去执行isAvailable就会返回false,debug在toInvokers方法后暂停main-EventThread线程继续执行,这个异常就能重现。
   做了个PR,才发现最新3.0分支的GenericServiceTest拆成了两个测试类,分拆之后原来的代码出异常的概率可能就小了。
   不过找了两天找到原因了还是很开心。


-- 
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


[GitHub] [dubbo] zrlw commented on issue #8675: [3.0] 单元测试org.apache.dubbo.config.spring.schema.GenericServiceTest的问题

Posted by GitBox <gi...@apache.org>.
zrlw commented on issue #8675:
URL: https://github.com/apache/dubbo/issues/8675#issuecomment-913780054


   前面92行的demoServiceRef.$invoke调用成功说明网络没有问题,日志里没有netty连接断开的信息,这两个Reference用的是一个长连接。
   跟踪了一下checkInvokerAvailable,调用的是ServiceDiscoveryRegistryDirectory的isAvailable方法:
   ```
       public boolean isAvailable() {
           if (isDestroyed()) {
               return false; <== 如果已经destroyed,则会触发Failed to check the status
           }
           Map<String, Invoker<T>> localUrlInvokerMap = urlInvokerMap;  <== 这个如果为空,那么也会触发
           if (localUrlInvokerMap != null && localUrlInvokerMap.size() > 0) {
               for (Invoker<T> invoker : new ArrayList<>(localUrlInvokerMap.values())) {
                   if (invoker.isAvailable()) {
                       return true;
                   }
               }
           }
           return false;
       }
   ```
   日志里没看到和destroy相关的信息,怀疑urlInvokerMap这个东西是空导致的问题,看了代码,这个东西是refreshInvoker刷进来的,跟踪了一下,貌似刷新的线程和执行ReferenceConfig的init方法的线程不是一个,刷新的线程名是main-EventThread,执行init的线程是main线程。跟进去refreshInvoker方法,发现这个方法调用toInvokers先把当前的urlInvokerMap里面的内容全清掉,在this.urlInvokerMap = newUrlInvokerMap重新赋值前,如果执行init的main线程去执行isAvailable就会返回false,debug在toInvokers方法后暂停main-EventThread线程继续执行,就能重新这个场景。
   做了个PR,才发现最新3.0分支的GenericServiceTest拆成了两个测试类,分拆之后原来的代码出异常的概率可能就小了。


-- 
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


[GitHub] [dubbo] zrlw edited a comment on issue #8675: [3.0] 单元测试org.apache.dubbo.config.spring.schema.GenericServiceTest的问题

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #8675:
URL: https://github.com/apache/dubbo/issues/8675#issuecomment-914280700


   看了一下3.0的RegistryDirectory,isAvailable和refreshInvoker也存在同样的问题啊,local reference不该这么用的吧,
   两个方法都去local reference引用urlInvokerMap这个集合,main线程执行isAvailable方法检查local reference的集合是否为空、不为空则进行遍历的时候,main-eventThread线程执行refreshInvoker对local reference的集合里面的entry直接进行remove,合适么?


-- 
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


[GitHub] [dubbo] zrlw commented on issue #8675: [3.0] 单元测试org.apache.dubbo.config.spring.schema.GenericServiceTest的问题

Posted by GitBox <gi...@apache.org>.
zrlw commented on issue #8675:
URL: https://github.com/apache/dubbo/issues/8675#issuecomment-913022950


   感觉这个问题和 #8676 是同一个问题,github自动构建环境可能有多块网卡,没有配置DUBBO_IP_TO_BIND参数时,ServiceConfig的findConfigedHosts调用InetAddress.getLocalHost().getHostAddress()获得GenericServiceTest测试类的服务绑定IP地址是随机的,而ReferenceConfig构造Reference引用调用的是NetUtils.getLocalHost(),多网卡环境下二者返回地址会不一致。


-- 
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


[GitHub] [dubbo] zrlw edited a comment on issue #8675: [3.0] 单元测试org.apache.dubbo.config.spring.schema.GenericServiceTest的问题

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #8675:
URL: https://github.com/apache/dubbo/issues/8675#issuecomment-913098640


   从github构建日志看,genericServiceWithoutInterface.$invoke这个ReferenceBean是lazy initializing: 
   ```
   2021-09-04T20:19:48.3314340Z 20:19:47.115 [main] DEBUG org.apache.dubbo.config.spring.ReferenceBean$DubboReferenceLazyInitTargetSource - Initializing lazy target object
   ```
   也就是说单元测试执行到下面这条语句时才会创建这个ReferenceBean:
   ```
   result = genericServiceWithoutInterfaceRef.$invoke("sayHello", new String[]{"java.lang.String"}, new Object[]{"generic"});
   ```
   但是ReferenceConfig的init方法最后要调用checkInvokerAvailable去检查invoker连接是否已经ok,节奏是不是有点太快了,延迟初始化的ReferenceBean刚完成构建,相关的连接立马就ok?
   github日志显示40多ms后,main线程收到一个null应答后就开始执行Unsubscribe操作了,这时候checkInvokerAvailable应该已经抛过异常了:
   ```
   2021-09-04T20:19:48.3751852Z 20:19:47.246 [main-SendThread(MiningMadness.com:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x10000493ad40000, packet:: clientPath:null serverPath:null finished:false header:: 147,2  replyHeader:: 147,41,0  request:: '/dubbo/org.apache.dubbo.config.spring.api.LocalMissClass/consumers/dubbo%253A%252F%252F172.17.16.1%252Forg.apache.dubbo.config.spring.api.LocalMissClass%253Fapplication%253Ddubbo-generic-consumer%2526category%253Dconsumers%2526check%253Dfalse%2526dubbo%253D2.0.2%2526file.cache%253Dfalse%2526generic%253Dtrue%2526init%253Dfalse%2526interface%253Dorg.apache.dubbo.config.spring.api.LocalMissClass%2526metadata-type%253Dremote%2526pid%253D6992%2526release%253D3.0.3-SNAPSHOT%2526side%253Dconsumer%2526sticky%253Dfalse%2526timestamp%253D1630786787116,-1  response:: null
   2021-09-04T20:19:48.3759385Z [04/09/21 20:19:47:247 UTC] main  INFO zookeeper.ZookeeperRegistry:  [DUBBO] Unsubscribe: dubbo://172.17.16.1/org.apache.dubbo.config.spring.api.LocalMissClass?application=dubbo-generic-consumer&category=providers,configurators,routers&dubbo=2.0.2&file.cache=false&generic=true&init=false&interface=org.apache.dubbo.config.spring.api.LocalMissClass&metadata-type=remote&pid=6992&release=3.0.3-SNAPSHOT&side=consumer&sticky=false&timestamp=1630786787116, dubbo version: 3.0.3-SNAPSHOT, current host: 172.17.16.1
   ```
   完整日志见:
   https://github.com/apache/dubbo/runs/3514650085?check_suite_focus=true  点设置里的download log archive,下载后打开里面的 4_Unit Test On windows-2019 (JDK 11).txt,文件很大,记事本打不开或者龟速,需要用notepad++之类的大文件编辑工具看。


-- 
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