(cli): describeStackEvents queries ALL stack events when looking for new events #32186
Closed
1 task done
Labels
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p0
package/tools
Related to AWS CDK Tools or CLI
potential-regression
Marking this issue as a potential regression to be checked by team member
Describe the bug
After upgrading to 2.167.0, our deployments using GitHub Actions went from taking 10-11 minutes, to taking ~1 hour.
In reality, the deployments are taking roughly the same time, but the GitHub Actions runner is not receiving the answer.
I believe this is due to a change where all the stack events are loaded at once, before looping through them from newest to oldest and stopping when an event is met that has already been handled.
It should be said that I queried all stack events for one of our stacks and it has ~400,000 events.
Regression Issue
Last Known Working CDK Version
2.166.0
Expected Behavior
CLI getting feedback about stack deployment quickly.
Current Behavior
CLI not getting feedback about stack deployment until a long time after stack deployment has actually finished.
Reproduction Steps
The error only occurs when you have a stack with a large amount of stack events. I do not know how to reproduce that in a test.
The issue occurs for us when using
cdk deploy
with a stack that has ~400,000 stack events.Possible Solution
aws-cdk/packages/aws-cdk/lib/api/util/cloudformation/stack-event-poller.ts
Line 91 in b8f47c8
This method is calling
describeStackEvents
, and iterating through them, stopping when it reaches one that has already been handled, or one that is older than the poller itself.aws-cdk/packages/aws-cdk/lib/api/aws-auth/sdk.ts
Line 667 in b8f47c8
The method
describeStackEvents
is iterating through all pages of the stack events, before returning all of them.My suggestion is that the poller itself should be iterating through the pages of the stack events, similar to how it was in 2.166.0. Alternatively, the
describeStackEvents
should return an async iterable or something similar, but my TypeScript is not strong enough to know if that is possible :-)Additional Information/Context
No response
CDK CLI Version
2.167.1 (build d681b12)
Framework Version
No response
Node.js Version
v22.9.0
OS
macOS 14.6
Language
Python
Language Version
Python 3.10
Other information
No response
The text was updated successfully, but these errors were encountered: