kotlinx.coroutines icon indicating copy to clipboard operation
kotlinx.coroutines copied to clipboard

kotlinx.coroutines.scheduling.BlockingCoroutineDispatcherThreadLimitStressTest failed

Open dkhalanskyjb opened this issue 1 year ago • 2 comments

java.lang.AssertionError: Expected pool threads to be in interval 0..9, but has 10
  at org.junit.Assert.fail(Assert.java:89)
  at kotlin.test.junit.JUnitAsserter.fail(JUnitSupport.kt:56)
  at kotlin.test.Asserter$DefaultImpls.assertTrue(Assertions.kt:652)
  at kotlin.test.junit.JUnitAsserter.assertTrue(JUnitSupport.kt:30)
  at kotlin.test.Asserter$DefaultImpls.assertTrue(Assertions.kt:662)
  at kotlin.test.junit.JUnitAsserter.assertTrue(JUnitSupport.kt:30)
  at kotlin.test.AssertionsKt__AssertionsKt.assertTrue(Assertions.kt:44)
  at kotlin.test.AssertionsKt.assertTrue(Unknown Source)
  at kotlinx.coroutines.scheduling.SchedulerTestBase$Companion.checkPoolThreadsCreated(SchedulerTestBase.kt:35)
  at kotlinx.coroutines.scheduling.SchedulerTestBase$Companion.checkPoolThreadsCreated$default(SchedulerTestBase.kt:32)
  at kotlinx.coroutines.scheduling.BlockingCoroutineDispatcherThreadLimitStressTest$testLimitParallelismToOne$1.invokeSuspend(BlockingCoroutineDispatcherThreadLimitStressTest.kt:44)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
  at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
  at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
  at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
  at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
  at kotlinx.coroutines.TestBase.runTest(TestBase.kt:223)
  at kotlinx.coroutines.TestBase.runTest$default(TestBase.kt:215)
  at kotlinx.coroutines.scheduling.BlockingCoroutineDispatcherThreadLimitStressTest.testLimitParallelismToOne(BlockingCoroutineDispatcherThreadLimitStressTest.kt:24)
  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.base/java.lang.reflect.Method.invoke(Method.java:566)
  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
  at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
  at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
  at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
  at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
  at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
  at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
  at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
  at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
  at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
  at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
  at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
  at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
  at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
  at jdk.internal.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.base/java.lang.reflect.Method.invoke(Method.java:566)
  at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
  at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
  at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
  at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
  at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
  at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
  at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
  at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
  at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
  at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
  at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
  at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
  at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
  at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)

dkhalanskyjb avatar Nov 10 '23 12:11 dkhalanskyjb

Note: this test fails during the Linux CI.

Trying to reproduce this locally on Linux, but no success so far. CORES_COUNT is 12 for me, which may be why it's more difficult to saturate this number.

dkhalanskyjb avatar Dec 05 '23 12:12 dkhalanskyjb

I'll see what can be done here; high chances are the test is [probabilistically] incorrect; there are some probabilistic tests on scheduler I wrote back in 2019 that proved themselves unstable

qwwdfsad avatar Dec 05 '23 13:12 qwwdfsad