Skip to content

Commit

Permalink
Report child workflow started synchronously
Browse files Browse the repository at this point in the history
By reporting child workflow started asynchronously we can observe a child workflow attempting to complete prior to its state machine registering that it started. This is an invalid state transition and causes test failures.

See temporalio/sdk-java#1289 , we have the same test case still and it has similarly been flakey.
  • Loading branch information
natemort committed Oct 28, 2024
1 parent cecf223 commit e6ae042
Showing 1 changed file with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1179,17 +1179,13 @@ public void startWorkflow(
.setWorkflowExecution(getExecutionId().getExecution())
.setDomain(getExecutionId().getDomain())
.setWorkflowType(startRequest.getWorkflowType());
ForkJoinPool.commonPool()
.execute(
() -> {
try {
parent.get().childWorkflowStarted(a);
} catch (EntityNotExistsError | WorkflowExecutionAlreadyCompletedError e) {
// Not a problem. Parent might just close by now.
} catch (BadRequestError | InternalServiceError e) {
log.error("Failure reporting child completion", e);
}
});
try {
parent.get().childWorkflowStarted(a);
} catch (EntityNotExistsError | WorkflowExecutionAlreadyCompletedError e) {
// Not a problem. Parent might just close by now.
} catch (BadRequestError | InternalServiceError e) {
log.error("Failure reporting child completion", e);
}
}
}

Expand Down

0 comments on commit e6ae042

Please sign in to comment.