Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexOutOfBoundsException while running test #71

Closed
berndruecker opened this issue Nov 23, 2021 · 9 comments · Fixed by #87
Closed

IndexOutOfBoundsException while running test #71

berndruecker opened this issue Nov 23, 2021 · 9 comments · Fixed by #87

Comments

@berndruecker
Copy link
Member

I just tried the current snapshot and run a test. During one test run, I saw this exception - seemed to be a race condition - as I could not reproduce it.

I just wanted to flag it here - feel free to close given the current state of the testing library

java.lang.IndexOutOfBoundsException: index=78 length=4 capacity=192

	at org.agrona.concurrent.UnsafeBuffer.boundsCheck0(UnsafeBuffer.java:2259)
	at org.agrona.concurrent.UnsafeBuffer.getInt(UnsafeBuffer.java:565)
	at io.camunda.zeebe.protocol.record.VersionDecoder.majorVersion(VersionDecoder.java:90)
	at io.camunda.zeebe.protocol.impl.record.RecordMetadata.lambda$wrap$0(RecordMetadata.java:81)
	at java.base/java.util.Optional.map(Optional.java:260)
	at io.camunda.zeebe.protocol.impl.record.RecordMetadata.wrap(RecordMetadata.java:78)
	at io.camunda.zeebe.logstreams.impl.log.LoggedEventImpl.readMetadata(LoggedEventImpl.java:112)
	at org.camunda.community.eze.EngineFactory.createRecordStream(EngineFactory.kt:204)
	at org.camunda.community.eze.EngineFactory.createRecordStream$default(EngineFactory.kt:191)
	at org.camunda.community.eze.EngineFactory$create$4.invoke(EngineFactory.kt:108)
	at org.camunda.community.eze.EngineFactory$create$4.invoke(EngineFactory.kt:108)
	at org.camunda.community.eze.ZeebeEngineImpl.records(ZeebeEngineImpl.kt:34)
	at org.camunda.community.eze.RecordStreamSource$DefaultImpls.processInstanceRecords(RecordStreamSource.kt:26)
	at org.camunda.community.eze.ZeebeEngine$DefaultImpls.processInstanceRecords(ZeebeEngine.kt:12)
	at org.camunda.community.eze.ZeebeEngineImpl.processInstanceRecords(ZeebeEngineImpl.kt:14)
	at io.camunda.testing.filters.StreamFilter.processInstance(StreamFilter.java:9)
	at io.camunda.testing.assertions.ProcessInstanceAssert.isProcessInstanceCompleted(ProcessInstanceAssert.java:106)
	at io.camunda.testing.assertions.ProcessInstanceAssert.isCompleted(ProcessInstanceAssert.java:82)
	at io.berndruecker.playground.zeebe.tests.CamundaCloudZeebeTestsPlaygorundApplicationTest.testProcessInstanceIsStarted(CamundaCloudZeebeTestsPlaygorundApplicationTest.java:62)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)


Process finished with exit code -1
@remcowesterhoud
Copy link
Contributor

@berndruecker Could you possibly share the test code with us?

@berndruecker
Copy link
Member Author

Sure thing - here it is: https://github.com/berndruecker/camunda-cloud-zeebe-tests-playgorund/blob/main/src/test/java/io/berndruecker/playground/zeebe/tests/SimpleJavaTest.java (Ignore the other Spring Stuff - I also try to get a test running in the Spring Boot environment in parallel to validate a realistic test scenario).

PS: I am collecting feedback separately and might propose a quick call to go through this separately...

@berndruecker
Copy link
Member Author

Just talked to Holisticon today and they reported that they see this problem massively - the faster the machine the more often they saw it. Seems like there is some threading/race condition

@pihme
Copy link
Contributor

pihme commented Nov 26, 2021

@Zelldon / @saig0 Might also be interesting for you. Could it be that we are writing to the buffer and reading from it at the same time?

@ChrisKujawa
Copy link
Member

Thanks for mentioning me. I run into the same issue when I created new tests for the chaos workers and used eze camunda/zeebe-chaos@8c8c774

I fixed it in eze, see here camunda-community-hub/eze@949804a

@ChrisKujawa
Copy link
Member

It might not appear in your code anymore since you changed the implementation.

@remcowesterhoud
Copy link
Contributor

remcowesterhoud commented Dec 1, 2021

Thanks for sharing @Zelldon 🙇

Since we removed the use of exporters we will not run into this issue anymore. Therefore I will close this issue.

@pihme pihme reopened this Dec 1, 2021
@pihme
Copy link
Contributor

pihme commented Dec 1, 2021

I had it occur again. I tried to reactive the idle state monitor. It fails if there is an underlying exception as mentioned above

@ChrisKujawa
Copy link
Member

I think the issue is in your https://github.com/camunda-cloud/camunda-cloud-testing/blob/4a9346b2456b8cc44ec9ea87fc7c6f23b1cc12df/src/main/java/io/camunda/zeebe/bpmnassert/testengine/IdleStateMonitor.java#L11 where the processor (#onProcessed) can cause changes to the reader and the logstorage (#onCommit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants