zrlw edited a comment on issue #9210:
URL: https://github.com/apache/dubbo/issues/9210#issuecomment-962615219


   再说一下this.connectivityCheckFuture被创建的新任务重新赋值的问题:
   checkConnectivity异步创建的任务在结束前判断是否有新task,如果有就再次调用checkConnectivity:
   1. this.connectivityCheckFuture在checkConnectivity方法返回调用者之后又被赋了新值,但调用者并不知情;
   2. 调用者在旧的connectivityCheckFuture上等待的结果就是新task未执行完,调用者就继续执行后面的代码,然后出问题,比如:
   https://github.com/apache/dubbo/runs/4130565263?check_suite_focus=true
   ```
   2021-11-07T11:46:56.1815610Z [ERROR] Tests run: 3, Failures: 1, Errors: 0, 
Skipped: 0, Time elapsed: 0.19 s <<< FAILURE! - in 
org.apache.dubbo.rpc.cluster.support.ConnectivityValidationTest
   2021-11-07T11:46:56.1818867Z [ERROR] 
org.apache.dubbo.rpc.cluster.support.ConnectivityValidationTest.testRetry  Time 
elapsed: 0.007 s  <<< FAILURE!
   2021-11-07T11:46:56.1820680Z org.opentest4j.AssertionFailedError: expected: 
<2> but was: <1>
   2021-11-07T11:46:56.1822662Z         at 
org.apache.dubbo.rpc.cluster.support.ConnectivityValidationTest.testRetry(ConnectivityValidationTest.java:190)
   ```
   更新:
   
还不能简单地在checkConnectivity创建的task里面等待新任务结束,那样就违背了checkConnectivity的设计初衷,为了避免长时间占用connectivityExecutor,checkConnectivity采用的是分批处理的策略,所以PR
 #9211 
最终没有修改checkConnectivity方法,而是修改了ConnectivityValidationTest的waitRefresh方法,将等待条件改为invokersToReconnect列表里没有需要进行recover的invoker。


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

Reply via email to