CustomResource Provider: WaiterStateMachine doesn't stop when stack deployment is cancelled.
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
My team developed a custom resource that runs in asynchronous mode. We have noticed that when we cancel a CloudFormation stack update while an on-going WaiterStateMachine is running, the on-going WaiterStateMachine is not cancelled/stopped and it continues to call our IsComplete handler.
In the meantime the Rollback deployment starts and a new instance of the custom resource is called, and this leads to conflicts because the IsComplete handler for the cancelled deployment is still being called.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
_No response_
### Expected Behavior
What we ask is for a change such that all stack resources –including the WaiterStateMachine– stop on a stack cancel.
### Current Behavior
When we cancel a CloudFormation stack update the on-going WaiterStateMachine is not cancelled/stopped and it continues to call our IsComplete handler.
### Reproduction Steps
Create asynchronous custom resource in a stack, deploy the stack, cancel the deployment.
### Possible Solution
What we ask is for a change such that all stack resources –including the WaiterStateMachine– stop on a stack cancel.
This behavior can be enabled by a flag for backwards compatibility.
Alternatively, you can pass a flag that says if the deployment is cancelled into the event for the IsComplete handler, so that the implementer can decide to check that flag and always return "true" if that flag is set (or keep running if that's their jam).
### Additional Information/Context
_No response_
### CDK CLI Version
2.154.1
### Framework Version
_No response_
### Node.js Version
18
### OS
AL2
### Language
TypeScript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Reproduce the issue with an asynchronous custom resource by deploying a stack and cancelling its update while the WaiterStateMachine is running. Start by tracing the WaiterStateMachine and IsComplete handler behavior during cancellation; done means the in-progress waiter stops, or the handler receives a cancellation signal, without continuing calls during rollback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100