dragonwell-project / dragonwell8

Alibaba Dragonwell8 JDK
http://dragonwell-jdk.io
GNU General Public License v2.0
4.2k stars 496 forks source link

[Bug] GlobalPollerTest.java随机失败 #371

Closed sendaoYan closed 2 years ago

sendaoYan commented 2 years ago

Description jdk/test/com/alibaba/wisp/io/GlobalPollerTest.java随机失败

Steps to Reproduce Steps to reproduce the behavior:

test=jdk/test/com/alibaba/wisp/io/GlobalPollerTest.java
dir="tmp-jtreg-"`basename $test .java` ; rm -rf $dir ; mkdir -p $dir ; time seq 500 | xargs -i -n 1 -P `nproc` bash -c "jtreg -timeoutFactor:8 -v:fail,error,time,nopass -nr -w $dir/index-{} $test &> $dir/{}.log ; grep 'Test results: passed: 1' -L $dir/{}.log"
java.lang.RuntimeException: Expected non null reference
    at jdk.testlibrary.Asserts.error(Asserts.java:438)
    at jdk.testlibrary.Asserts.assertNotEquals(Asserts.java:322)
    at jdk.testlibrary.Asserts.assertNotNull(Asserts.java:366)
    at jdk.testlibrary.Asserts.assertNotNull(Asserts.java:355)
    at GlobalPollerTest.main(GlobalPollerTest.java:88)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
    at java.lang.Thread.run(Thread.java:[85](https://github.com/alibaba/dragonwell8/runs/7556267675?check_suite_focus=true#step:6:86)5)

复现概率:大概1/10

不确定85行的fd2TaskLow对象赋值是否被执行

image

https://github.com/alibaba/dragonwell8/runs/7556267675?check_suite_focus=true

Expected behavior run pass everytime

JDK version

openjdk version "1.8.0_332"
OpenJDK Runtime Environment (Alibaba Dragonwell 8.11.12) (build 1.8.0_332-b01)
OpenJDK 64-Bit Server VM (Alibaba Dragonwell 8.11.12) (build 25.332-b01, mixed mode)

Execution environment image

sendaoYan commented 2 years ago

复现命令:

for i in `seq 200` ; do time jtreg -v:fail,error,nopass -ignore:quiet -r jt-report-$i -w jt-work-$i -exclude:jdk/test/ProblemList.txt "jdk/test/:dragonwell_jdk_features" &> test-$i.log ; done

失败概率:1/20

image

test-7.log test-55.log test-65.log test-100.log test-119.log test-127.log test-135.log test-143.log test-183.log test-197.log

image

com/alibaba/wisp2/CarrierAsPollerTest.java
com/alibaba/wisp/ExecutionTest.java
com/alibaba/wisp/IoTest.java
com/alibaba/wisp/io/GlobalPollerTest.java

CarrierAsPollerTest用例失败概率:1/50

失败trace:

java.lang.RuntimeException: Expected non null reference
    at jdk.testlibrary.Asserts.error(Asserts.java:438)
    at jdk.testlibrary.Asserts.assertNotEquals(Asserts.java:322)
    at jdk.testlibrary.Asserts.assertNotNull(Asserts.java:366)
    at jdk.testlibrary.Asserts.assertNotNull(Asserts.java:355)
    at CarrierAsPollerTest.main(CarrierAsPollerTest.java:56)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
    at java.lang.Thread.run(Thread.java:855)
    at com.alibaba.wisp.engine.WispTask.runOutsideWisp(WispTask.java:299)
    at com.alibaba.wisp.engine.WispTask.runCommand(WispTask.java:274)
    at com.alibaba.wisp.engine.WispTask.access$100(WispTask.java:53)
    at com.alibaba.wisp.engine.WispTask$CacheableCoroutine.run(WispTask.java:241)
    at java.dyn.CoroutineBase.startInternal(CoroutineBase.java:62)

owner对象为空,可能是协程还未启动完成,还是协程已经运行结束?

image

com/alibaba/wisp/ExecutionTest.java失败概率:5/200

java.lang.Error: not finished
    at ExecutionTest.main(ExecutionTest.java:111)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
    at java.lang.Thread.run(Thread.java:855)

sleep(200)该方式等待协程执行完成,不是很可靠

image

com/alibaba/wisp/IoTest.java 失败概率1/200

java.lang.Error: java.io.IOException: Connection reset by peer
    at IoTest.http(IoTest.java:87)
    at IoTest.main(IoTest.java:58)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
    at java.lang.Thread.run(Thread.java:855)
Caused by: java.io.IOException: Connection reset by peer
    at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:225)
    at sun.nio.ch.IOUtil.read(IOUtil.java:199)
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:393)
    at IoTest.read(IoTest.java:93)
    at IoTest.http(IoTest.java:82)
    ... 7 more

image

sendaoYan commented 2 years ago

jdk/test/com/alibaba/wisp/thread/PreemptTest.java在linux-aarch64平台上随机失败:

失败概率:21/50

测试命令:

test=jdk/test/com/alibaba/wisp/thread/PreemptTest.java 
nproc=`nproc` ; dir="tmp-jtreg-"`basename $test .java` ; rm -rf $dir ; mkdir -p $dir ; time seq 50 | xargs -i -n 1 -P `expr $nproc / 2` bash -c "jtreg -timeoutFactor:8 -v:fail,error,time,nopass -nr -w $dir/index-{} $test &> $dir/{}.log ; grep 'Test results: passed: 1' -L $dir/{}.log"
java.lang.RuntimeException: Expected value to be true
    at jdk.testlibrary.Asserts.error(Asserts.java:438)
    at jdk.testlibrary.Asserts.assertTrue(Asserts.java:407)
    at jdk.testlibrary.Asserts.assertTrue(Asserts.java:395)
    at PreemptTest.doTest(PreemptTest.java:51)
    at PreemptTest.main(PreemptTest.java:44)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
    at java.lang.Thread.run(Thread.java:855)

image