Hi,
I have a parent workflow that executes a sequence of CancellationScopes. Each CancellationScope will asynchronously trigger an activity or a child workflow. The cancellation scopes’ use async.procedure() or async.function() to trigger the child workflow or the child activity. The parent workflow waits for the completion of the cancellationscope’s execution or a cancel signal being sent to the parent workflow. Once parent workflow receives a cancel signal, it cancels the cancellationscope using scope.cancel() and exits the workflow. For one of the cancellationscopes execution, i get the following error
io.temporal.internal.sync.DestroyWorkflowThreadError: null
at io.temporal.internal.sync.WorkflowThreadContext.lambda$destroy$597e554$1(WorkflowThreadContext.java:272)
at io.temporal.internal.sync.WorkflowThreadContext.mayBeEvaluate(WorkflowThreadContext.java:107)
at io.temporal.internal.sync.WorkflowThreadContext.yield(WorkflowThreadContext.java:84)
at io.temporal.internal.sync.WorkflowThreadImpl.yield(WorkflowThreadImpl.java:410)
at io.temporal.internal.sync.WorkflowThread.await(WorkflowThread.java:45)
at io.temporal.internal.sync.SyncWorkflowContext.await(SyncWorkflowContext.java:685)
at io.temporal.internal.sync.WorkflowInternal.await(WorkflowInternal.java:304)
at io.temporal.workflow.Workflow.await(Workflow.java:747)
This exception is seen even when there is no trigger for cancel is present.
I have a try/catch block that surrounds the child workflow execution in the parent workflow. And I have added a “finally” in parent workflow to do some cleanup at the end of execution. When the child workflow throws that above exception, i see that the finally block gets executed.
from the https://community.temporal.io/t/temporal-workflow-destroyworkflowthreaderror/861 thread I assume we should not catch throwable or error. in that case, can we use finally in the parent workflow?
from the above thread i assume the temporal is using errors and throwables as internal mechanisms to do framework functions. is that correct?. in that context, is the use of finally correct here? because the finally block itself seems to be executing every time one of the child workflows throws the above DestroyWorkflowThreadError.