Hi zhouxiaxiang, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: sig-Java, and any of the maintainers: @雒海波 , @sinever , @chong_W , @rita_dong , @caodongxia , @xu_ping
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
失败现象:
[INFO] Running org.xnio.nio.test.NioTcpChannelTestCase
[ 157s] [INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.042 s - in org.xnio.nio.test.NioTcpChannelTestCase
[ 157s] [INFO] Running org.xnio.nio.test.XnioWorkerTestCase
[ 157s] [ERROR] Tests run: 27, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 0.475 s <<< FAILURE! - in org.xnio.nio.test.XnioWorkerTestCase
[ 157s] [ERROR] cancelAcceptStreamConnection(org.xnio.nio.test.XnioWorkerTestCase) Time elapsed: 0.003 s <<< FAILURE!
[ 157s] java.lang.AssertionError
[ 157s] at org.junit.Assert.fail(Assert.java:86)
[ 157s] at org.junit.Assert.assertTrue(Assert.java:41)
[ 157s] at org.junit.Assert.assertNotNull(Assert.java:712)
[ 157s] at org.junit.Assert.assertNotNull(Assert.java:722)
[ 157s] at org.xnio.nio.test.XnioWorkerTestCase.cancelAcceptStreamConnection(XnioWorkerTestCase.java:455)
[ 157s] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ 157s] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ 157s] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ 157s] at java.lang.reflect.Method.invoke(Method.java:498)
[ 157s] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
[ 157s] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
[ 157s] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:52)
[ 157s] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
[ 157s] at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
[ 157s] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
[ 157s] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
[ 157s] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
[ 157s] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
[ 157s] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
[ 157s] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
[ 157s] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
[ 157s] at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
[ 157s] at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
[ 157s] at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
[ 157s] at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
[ 157s] at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
[ 157s] at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
[ 157s] at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
[ 157s] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
[ 157s] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
[ 157s] at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
[ 157s] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)
[ 157s]
[ 157s] [INFO] Running org.xnio.nio.test.FullDuplexChannelPipeTestCase
[ 157s] [WARNING] Tests run: 14, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.109 s - in org.xnio.nio.test.FullDuplexChannelPipeTestCase
[ 157s] [INFO] Running org.xnio.nio.test.FileSystemWatcherTestCase
[ 157s] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 s - in org.xnio.nio.test.FileSystemWatcherTestCase
[ 157s] [INFO] Running org.xnio.nio.test.TcpConnectionTestCase
[ 158s] [WARNING] Tests run: 9, Failures: 0, Errors: 0, Skipped: 2, Time elapsed: 0.109 s - in org.xnio.nio.test.TcpConnectionTestCase
[ 158s] [INFO] Running org.xnio.nio.test.MultiThreadedNioTcpChannelTestCase
[ 158s] [INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.019 s - in org.xnio.nio.test.MultiThreadedNioTcpChannelTestCase
[ 158s] [INFO] Running org.xnio.nio.test.NioFullDuplexChannelPipeTestCase
[ 158s] [INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 s - in org.xnio.nio.test.NioFullDuplexChannelPipeTestCase
[ 158s] [INFO] Running org.xnio.nio.test.TcpChannelTestCase
[ 158s] [WARNING] Tests run: 12, Failures: 0, Errors: 0, Skipped: 2, Time elapsed: 0.111 s - in org.xnio.nio.test.TcpChannelTestCase
[ 158s] [INFO] Running org.xnio.nio.test.UdpChannelTestCase
[ 158s] [WARNING] Tests run: 10, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.11 s - in org.xnio.nio.test.UdpChannelTestCase
[ 158s] [INFO] Running org.xnio.nio.test.ConnectionOptionSetupTestCase
[ 158s] [INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.099 s - in org.xnio.nio.test.ConnectionOptionSetupTestCase
[ 166s] [INFO]
[ 166s] [INFO] Results:
[ 166s] [INFO]
[ 166s] [ERROR] Failures:
[ 166s] [ERROR] XnioWorkerTestCase.cancelAcceptStreamConnection:455
[ 166s] [INFO]
[ 166s] [ERROR] Tests run: 121, Failures: 1, Errors: 0, Skipped: 9
[ 166s] [INFO]
[ 166s] [INFO]
[ 166s] [INFO] ------------------------------------------------------------------------
[ 166s] [INFO] Skipping XNIO Parent POM
[ 166s] [INFO] This project has been banned from the build due to previous failures.
[ 166s] [INFO] ----------------------------------------------------------------------
该失败用例为:https://github.com/xnio/xnio/blob/3.4.0.Final/nio-impl/src/test/java/org/xnio/nio/test/XnioWorkerTestCase.java 第453行,如下:
434 @Test
435 public void cancelAcceptStreamConnection() throws CancellationException, IOException {
436 final XnioWorker xnioWorker = xnio.createWorker(OptionMap.EMPTY);
437 final TestChannelListener<StreamConnection> channelListener = new TestChannelListener<StreamConnection>();
438 final TestChannelListener<BoundChannel> bindListener = new TestChannelListener<BoundChannel>();
439 final IoFuture<StreamConnection> connectionFuture1 = xnioWorker.acceptStreamConnection(bindAddress, channelListener, bindListener, OptionMap.EMPTY);
440 final IoFuture<StreamConnection> connection2 = xnioWorker.openStreamConnection(bindAddress, null, OptionMap.EMPTY);
441
442 assertNotNull(connectionFuture1);
443 assertNotNull(connection2);
444
445 connectionFuture1.cancel();
446
447 CancellationException expected = null;
448 try {
449 connectionFuture1.get();
450 } catch (CancellationException e) {
451 expected = e;
452 }
453 assertNotNull(expected);
454
455 assertFalse(channelListener.isInvokedYet());
456 assertFalse(channelListener.isInvokedYet());
457 if (bindListener.isInvokedYet()) {
458 BoundChannel boundChannel = bindListener.getChannel();
459 assertNotNull(boundChannel);
460 assertFalse(boundChannel.isOpen());
461 }
462 }
失败的原因:connectionFuture1.cancel()执行失败,导致connectionFuture1.get()执行成功,从而expected为空,最终assertNotNull(expected)断言失败。
根因同issue:#I5LS0G:xnio build problem in openEuler:22.09
该测试用例根据环境的不同存在概率性失败,这种用例不保证100%成功,上游社区最新的解决办法是connectionFuture1.cancel()执行失败后重新执行一次,减少偶线失败的概率。
上游社区修改提交:https://github.com/xnio/xnio/commit/f4e4b053e29298be8df8941aefc93d82c0be2f1c
上游社区该提交在3.8.3版本合入,由于xnio上层依赖较多,升级影响较大,建议先跳过该用例。
登录 后才可以发表评论