Closed egorzot closed 1 year ago
Hey @egorzot 👋🏻
You're using outdated RR version which is not supported anymore. Please, retry this on a v2023.2.2
.
Also, what is your temporal/sdk version? (php-sdk)
Hi @egorzot.
Try to add sleep(15);
after the $workflow->cancel();
Try to add sleep(15); after the $workflow->cancel();
@roxblnfk it works! Could you explain, please?
There are two concurrent events: activity finishing and workflow cancelation.
After activity finish the WF will be closed without any event because there are no any action or condition to continue execution. And it just happens before the cancel event.
Using sleep()
you freeze workflow execution and provide some time to Temporal to schedule and execute the Cancel event.
$workflow->cancel();
won't wait any close operation result from Temporal. It just will validate the workflow is existing and wasn't closed.
Ok, since this is not a bug, I'm closing this issue. For tech support feel free to join temporal slack or SpiralScout discord server (https://discord.gg/spiralphp)
In short: this is because the async nature of cancel call, code does not block on it since cancel might take a long time to complete (some cleanup activities for example).
The proper way to cancel workflow from inside the activity - return the result from activity that indicates the parent workflow that it has to be cancelled (i.e. NonRetryable error).
No duplicates 🥲.
What happened?
I created an example for reproducing the behavior. A new CancelWorkflow with Activity that cancels that workflow (forked from https://github.com/temporalio/samples-php)
I am using the command:
docker-compose exec app php app.php cancel-activity
Result:
I'm expecting workflow canceling from the activity
Version
RoadRunner version: 2.12.3
Relevant log output