Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-s3: Bucket with notifications has a delete stack race condition #23656

Closed
adrianmace opened this issue Jan 12, 2023 · 3 comments
Closed

aws-s3: Bucket with notifications has a delete stack race condition #23656

adrianmace opened this issue Jan 12, 2023 · 3 comments
Labels
@aws-cdk/aws-s3 Related to Amazon S3 bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@adrianmace
Copy link
Contributor

Describe the bug

When you define a Bucket resource and attach notifications to it (using the Custom::S3BucketNotifications resource under the hood) then try to delete the whole stack, it can sometimes (often) get into a race condition where the bucket delete and final put_bucket_notification_configuration call conflict.

A picture is worth 1000 words.
image

Expected Behavior

The stack can be deleted successfully.

Current Behavior

The delete fails. See image above.

If you click delete again, it succeeds the second time.

Reproduction Steps

The code above is programmatically generated and cannot be shared. The crux of the issue is however to:

  1. Create a Lambda function
  2. Create a bucket bucket
  3. Attach a notification on the bucket for ObjectCreated Put
  4. Attach a notification on the bucket for ObjectCreated Post (important: two notifications configured)
  5. Deploy the stack
  6. Attempt to delete the stack

Possible Solution

Make the function dependant on the bucket, so that Cloudformation will delete the function before the bucket in every situation.

Additional Information/Context

No response

CDK CLI Version

2.59.0

Framework Version

No response

Node.js Version

N/A

OS

N/A

Language

Python

Language Version

Python 3.10.9

Other information

No response

@adrianmace adrianmace added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 12, 2023
@github-actions github-actions bot added the @aws-cdk/aws-s3 Related to Amazon S3 label Jan 12, 2023
@pahud
Copy link
Contributor

pahud commented Feb 23, 2023

Thank you for the report. Are you able to share a repo with minimal required cdk code so we can deploy in our account and reproduce that?

@pahud pahud added needs-reproduction This issue needs reproduction. and removed needs-triage This issue or PR still needs to be triaged. labels Feb 23, 2023
@pahud pahud self-assigned this Feb 23, 2023
@pahud pahud added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Mar 15, 2023
@pahud pahud removed their assignment Mar 15, 2023
@pahud pahud added the p2 label Mar 15, 2023
@github-actions
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Mar 15, 2023
@adrianmace
Copy link
Contributor Author

Hi @pahud,

Sorry that I didn't get back to you on this.

It looks like #24762 is possibly related to this / a duplicate. That was closed and merged into #16811 as being a duplicate, but overall this 'race condition' still exists.

I don't have a minimal example handy since this is built into a pretty complicated CDK app, but the reproduction steps are complete.

I can confirm this is still an issue which is causing us trouble at least weekly.

@pahud pahud removed the needs-reproduction This issue needs reproduction. label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-s3 Related to Amazon S3 bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants