cadence-java-client icon indicating copy to clipboard operation
cadence-java-client copied to clipboard

TestWorkflowEnvironment throws WorkflowExecutionAlreadyCompletedError while executing tests succesfully

Open WellingR opened this issue 4 years ago • 0 comments

When executing the tests in https://github.com/uber/cadence-java-samples (e.g. HelloAsyncLambdaTest) most of them log an exception even though the test itself succeeds.

It seems that DecisionTask StartToCloseTimeout is being executed even after the workflow is already completed. Why is this task executed at all?

The following stacktrace appears in the test output (for most of the test cases in this samples project)

11:59:54.364 [Timer task] ERROR c.u.c.i.t.TestWorkflowMutableStateImpl - Failure trying to timeout a decision scheduledEventId=1
com.uber.cadence.WorkflowExecutionAlreadyCompletedError: Workflow is already completed: COMPLETED
	at com.uber.cadence.internal.testservice.TestWorkflowMutableStateImpl.checkCompleted(TestWorkflowMutableStateImpl.java:1210)
	at com.uber.cadence.internal.testservice.TestWorkflowMutableStateImpl.update(TestWorkflowMutableStateImpl.java:226)
	at com.uber.cadence.internal.testservice.TestWorkflowMutableStateImpl.completeDecisionUpdate(TestWorkflowMutableStateImpl.java:215)
	at com.uber.cadence.internal.testservice.TestWorkflowMutableStateImpl.timeoutDecisionTask(TestWorkflowMutableStateImpl.java:713)
	at com.uber.cadence.internal.testservice.TestWorkflowMutableStateImpl.lambda$startDecisionTask$0(TestWorkflowMutableStateImpl.java:307)
	at com.uber.cadence.internal.testservice.SelfAdvancingTimerImpl$TimerPump.lambda$runLocked$0(SelfAdvancingTimerImpl.java:99)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

I am running into this issue while implementing tests in my own project, and having these errors in the output is very confusing.

WellingR avatar Aug 16 '21 11:08 WellingR