microsoft / durabletask-go

The Durable Task Framework is a lightweight, embeddable engine for writing durable, fault-tolerant business logic (orchestrations) as ordinary code.
Apache License 2.0
178 stars 25 forks source link

Fix: PurgeOrchestration errors out when used with retryable sub-orchestrations #63

Closed shivamkm07 closed 5 months ago

shivamkm07 commented 5 months ago

On trying to purge an orchestration that creates retryable sub-orchestrations, it fails with Segmentation Fault error. More details of the issue can be found here: https://github.com/dapr/dapr/issues/7422

The issue happens because in case of retryable sub-orchestrations, there are multiple instances of same sub-orchestration (with same instanceId) in the orchestration state and the purge logic tries to purge each of them recursively and so fails while trying to purge a sub-orchestration again which has been already purged. The PR fixes the implementation to filter out duplicate instanceIDs while purging.