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


   ### Environment
   
   * Dubbo version: 3.0
   github构建日志
   ```
   [INFO] Running 
org.apache.dubbo.remoting.api.MultiplexProtocolConnectionManagerTest
   Error:  Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 
0.046 s <<< FAILURE! - in 
org.apache.dubbo.remoting.api.MultiplexProtocolConnectionManagerTest
   Error:  testForEachConnection  Time elapsed: 0.029 s  <<< ERROR!
   java.lang.IllegalStateException: No such extension 
org.apache.dubbo.remoting.api.WireProtocol by name tri, no related exception 
was found, please check whether related SPI module is missing.
        at 
org.apache.dubbo.remoting.api.MultiplexProtocolConnectionManagerTest.testForEachConnection(MultiplexProtocolConnectionManagerTest.java:53)
   ```
   测试方法代码:
   ```
       public void testForEachConnection() throws RemotingException {
           {
               URL url = URL.valueOf("empty://127.0.0.1:8080?foo=bar");
               Connection connect = connectionManager.connect(url);
           }
           {
               URL url = URL.valueOf("tri://127.0.0.1:8080?foo=bar");
               Connection connect = connectionManager.connect(url); <== throw 
IllegalStateException at line 53
           }
     
           Consumer<Connection> consumer = new Consumer<Connection>() {
               @Override
               public void accept(Connection connection) {
                   try {
                       Assertions.assertEquals("empty", 
connection.getUrl().getProtocol());
                   } catch (Exception e) {
                       Assertions.assertEquals("tri", 
connection.getUrl().getProtocol());
                   }
   
               }
           };
   
           connectionManager.forEachConnection(consumer);
       }
   ```
   
   问题重现方法:
   把创建两个Connection的代码块顺序颠倒一下,首先创建tri的connection。
   
   分析原因:
   
指令重排导致tri的连接先行创建,但META-INF/dubbo/internal/org.apache.dubbo.remoting.api.WireProtocol文件里没有配置tri扩展。
   其他问题:
   1. 两个connection的url用了相同的地址(host和port相同),导致只会建一个Connection;
   3. catch捕捉的类型错, 断言异常AssertionFailedError是Error类型,捕获Exception是捕获不到的。


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