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 25, 2024
1 parent 8693c37 commit 265aa4b
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) {

Check warning on line 1184 in src/main/java/com/uber/cadence/internal/testservice/TestWorkflowMutableStateImpl.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/uber/cadence/internal/testservice/TestWorkflowMutableStateImpl.java#L1184

Added line #L1184 was not covered by tests
// Not a problem. Parent might just close by now.
} catch (BadRequestError | InternalServiceError e) {
log.error("Failure reporting child completion", e);

Check warning on line 1187 in src/main/java/com/uber/cadence/internal/testservice/TestWorkflowMutableStateImpl.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/uber/cadence/internal/testservice/TestWorkflowMutableStateImpl.java#L1186-L1187

Added lines #L1186 - L1187 were not covered by tests
}
}
}

Expand Down

0 comments on commit 265aa4b

Please sign in to comment.