-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
(cli): cdk watch does not recover if there is an error in cdk stack/app #27864
(cli): cdk watch does not recover if there is an error in cdk stack/app #27864
Comments
thanks @ssingh-01 for reporting this. |
I'm running into this issue as well. I've been working around the issue with ctrl c and re-running cdk watch. I think the issue is that the cdk cli isn't releasing the outdir lock when a synth fails. The problem is here:
I think the lines that follow should live in a try/catch - when the exec fails, I think the catch should probably release the lock and rethrow the error. |
### 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 - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Comments on closed issues and PRs are hard for our team to see. |
Describe the bug
If I made an error that does not resolve into a valid cloudformation, cdk watch throws the error on console. However, if I fix that issue, I would expect cdk to detect the issue to resolve and deploy the correct cloudformation template. CDK watch gets hung instead.
Expected Behavior
Expect cdk watch to redeploy once the error has been fixed.
Current Behavior
If I made an error that does not resolve into a valid cloudformation, cdk watch throws the error on console. However, if I fix that issue, CDK watch gets hung. It detects the change but does not deploy.
Reproduction Steps
This is a valid stack and app :
If I update it to the following while cdk watch is running, cdk watch will throw the error but stays hung after I fix the error (remove a mistyped N in this case):
This happens with stack level changes as well.
Detects change but does not deploy, stays in hung state :
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
v2.100.0
Framework Version
No response
Node.js Version
v18.16.0
OS
MAC
Language
Python
Language Version
3.10.6
Other information
Reproducible with typescript too
Workaround is to interrupt the terminal and re run cdk watch.
The text was updated successfully, but these errors were encountered: