temporalio / temporalio/sdk-java
[Bug] Cancelling an activity results in `FailedPrecondition: ACTIVITY_UNKNOWN` error on time skipping server
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 433
- Forks
- 249
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 26
Description
Describe the bug
A user has a workflow that attempts to cancel an activity in the very same WFT where that activity completes (eg. it cancels the activity from a signal handler, so the activity promise has not yet been marked as completed).
Using the official server, the workflows continues execution without problem.
However, using the time skipping test server, the workflow get stuck, and the following error message is being displayed:
Network error while completing workflow activation error=status: FailedPrecondition, message: "ACTIVITY_UNKNOWN for scheduledEventId=41"
Minimal Reproduction
A user provided this repro.
Another user provided the following code:
try {
await someActivity(); // someActivity works here
await someActivityThatTriggersCancelation();
} catch (e: unknown) {
if (isCancellation(e)) {
await CancellationScope.nonCancellable(async () => {
await someActivity(); // someActivity fails with "ACTIVITY_UNKNOWN" here
});
}
}
He also mentioned that he would encounter the same thing if he calls handle.cancel() outside of any activity, in the outer test context.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked reproduction at src/tests/networkError.test.ts and reproduce the ACTIVITY_UNKNOWN failure on the time-skipping test server. Compare the cancellation and completion scenario with the official server behavior; the work is done when the workflow continues without the network error or becoming stuck.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100