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

fix(cli): release outdir lock when synth fails #30874

Merged
merged 7 commits into from
Sep 16, 2024
Merged

Conversation

misterjoshua
Copy link
Contributor

@misterjoshua misterjoshua commented Jul 17, 2024

Issue # (if applicable)

Closes #27864

Reason for this change

When using cdk watch mode, a synth failure causes the CDK CLI to no longer deploy changes. The CDK CLI must be restarted to resume watch mode. The cause of the issue is that CDK CLI never releases the outdir write lock if synthing fails, so subsequent attempts to exec the user's app cannot acquire the outdir writer lock.

Description of changes

I added a try/catch that releases the outdir writer lock & rethrows the error when a synth fails.

Description of how you validated changes

I added a unit test. I also ran the modified cdk cli on a project of my own and simulated the failure of a synth to see whether the issue was resolved, and it is.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p2 star-contributor [Pilot] contributed between 25-49 PRs to the CDK labels Jul 17, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team July 17, 2024 00:54
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation aws-cdk-automation added the pr/needs-cli-test-run This PR needs CLI tests run against it. label Jul 17, 2024
@scanlonp
Copy link
Contributor

This makes good sense. Let me know when it's ready for review, and we can run it through the pipeline.

@misterjoshua misterjoshua marked this pull request as ready for review July 17, 2024 01:27
@misterjoshua
Copy link
Contributor Author

@scanlonp Thanks for checking in. I've marked it ready now. I'll keep an eye out for feedback. TY

@scanlonp
Copy link
Contributor

Can look at our testing for cdk watch, but not sure we have the infrastructure for integ testing this type of change. Going to put the integ test exempt label for now.

I can also pull this down and test it out; I assume this fixed watch hanging on your side @misterjoshua?

@scanlonp scanlonp added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Jul 17, 2024
@misterjoshua
Copy link
Contributor Author

misterjoshua commented Jul 17, 2024

@scanlonp

Can look at our testing for cdk watch, but not sure we have the infrastructure for integ testing this type of change. Going to put the integ test exempt label for now.

Sounds good. I wasn't sure about that part and had been asking around. 😂

I can also pull this down and test it out; I assume this fixed watch hanging on your side @misterjoshua?

Yep. Works great for me!

@scanlonp
Copy link
Contributor

@Mergifyio update

Copy link
Contributor

mergify bot commented Jul 17, 2024

update

❌ Mergify doesn't have permission to update

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/close-stale-prs.yml without workflows permission

@aws-cdk-automation
Copy link
Collaborator

➡️ PR build request submitted to test-main-pipeline ⬅️

A maintainer must now check the pipeline and add the pr-linter/cli-integ-tested label once the pipeline succeeds.

@scanlonp
Copy link
Contributor

Worked clean in the pipeline. Adding labels.

@scanlonp scanlonp added pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested and removed pr/needs-cli-test-run This PR needs CLI tests run against it. labels Jul 17, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review July 17, 2024 17:22

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 17, 2024
@misterjoshua
Copy link
Contributor Author

misterjoshua commented Jul 22, 2024

@scanlonp Hey. Do I need to do anything with the code to move this PR forward? I saw that the CodeQL action failed, but its failure appears to be an out-of-space condition not necessarily related to this change.

@scanlonp
Copy link
Contributor

Hey @misterjoshua, I think the code is in a good spot. I want to test this out myself just to double check (even though I 100% believe your local testing results!). I'll make it a goal to have it in by the next release.

Also I believe the CodeQL is not concerning for this PR. We have been seeing that out-of-space failure consistently.

@misterjoshua
Copy link
Contributor Author

@scanlonp

Hey @misterjoshua, I think the code is in a good spot. I want to test this out myself just to double check (even though I 100% believe your local testing results!). I'll make it a goal to have it in by the next release.

Hey Parker. Sorry to bug, but how likely do you see this PR making it into the next release? Thanks.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 176d97f
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Sep 16, 2024
Copy link
Contributor

mergify bot commented Sep 16, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit b6ad97f into aws:main Sep 16, 2024
13 of 14 checks passed
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2024
@misterjoshua misterjoshua deleted the fix-27864 branch September 16, 2024 17:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. effort/small Small work item – less than a day of effort p2 pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested pr-linter/exempt-integ-test The PR linter will not require integ test changes star-contributor [Pilot] contributed between 25-49 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(cli): cdk watch does not recover if there is an error in cdk stack/app
5 participants