question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cfn-init - Unhandled exception during resume

See original GitHub issue

Started seeing these errors right before cfn-signal command in cfn-init section of CloudFormation Template for a Windows EC2 Instance -

2022-07-15 05:41:24,318 [DEBUG] Running command 01-signalInitComplete
2022-07-15 05:41:24,333 [DEBUG] No test for command 01-signalInitComplete
2022-07-15 05:41:24,648 [ERROR] Unhandled exception during resume: [Errno 2] No such file or directory: 'C:\\Windows\\TEMP\\tmpq73uv2cm/subp-stderr-c6db8147-6a05-4f44-b523-83bdbe0ace3a.txt'
Traceback (most recent call last):
  File "cfn-init", line 73, in <module>
  File "cfnbootstrap\construction.pyc", line 187, in resume
  File "cfnbootstrap\construction.pyc", line 578, in run_config
  File "cfnbootstrap\construction.pyc", line 146, in run_commands
  File "cfnbootstrap\command_tool.pyc", line 116, in apply
  File "cfnbootstrap\util.pyc", line 587, in call
  File "cfnbootstrap\util.pyc", line 562, in call
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Windows\\TEMP\\tmpq73uv2cm/subp-stderr-c6db8147-6a05-4f44-b523-83bdbe0ace3a.txt'

Also seeing intermittently these errors -

2022-07-15 22:33:26,445 [INFO] Command 00-installCrowdStrikeAgent succeeded
2022-07-15 22:33:26,445 [DEBUG] Command 00-installCrowdStrikeAgent output:
2022-07-15 22:33:26,455 [INFO] Waiting 10 seconds for reboot
2022-07-15 22:33:36,471 [DEBUG] Running command 01-installNSGAgent
2022-07-15 22:33:36,471 [DEBUG] No test for command 01-installNSGAgent
2022-07-15 22:34:43,431 [ERROR] Unhandled exception during resume: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Windows\\TEMP\\tmp
0v5ql8c4\\subp-stderr-f102e1b6-609e-4bac-8bba-4f0221cbbb1f.txt'
Traceback (most recent call last):
  File "cfn-init", line 73, in <module>
  File "cfnbootstrap\construction.pyc", line 187, in resume
  File "cfnbootstrap\construction.pyc", line 578, in run_config
  File "cfnbootstrap\construction.pyc", line 146, in run_commands
  File "cfnbootstrap\command_tool.pyc", line 116, in apply
  File "cfnbootstrap\util.pyc", line 587, in call
  File "cfnbootstrap\util.pyc", line 568, in call
  File "shutil.pyc", line 740, in rmtree
  File "shutil.pyc", line 618, in _rmtree_unsafe
  File "shutil.pyc", line 616, in _rmtree_unsafe
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Windows\\TEMP\\tmp0v5ql8c4\\subp-stderr-f102e1b6-609e-4bac-8bba-4f02
21cbbb1f.txt'

Because of no cfn-signal SUCCESS replies, the stack is getting timed-out

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
BEvgeniyScommented, Jul 29, 2022

I had to work around this by reverting cfn-bootstrap to older version (taken from previously working AMI)


## This should be executed before running `cfn-init`
Remove-Item "C:\Program Files\Amazon\cfn-bootstrap\*"  -Force
Read-S3Object -BucketName "<YOUR BUCKET HERE>" -Key "cfn-bootstrap.zip" -File "C:\Windows\temp\cfn-bootstrap.zip"
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\Windows\temp\cfn-bootstrap.zip", "C:\Program Files\Amazon\cfn-bootstrap\")
0reactions
mmaengcommented, Nov 2, 2022

Thanks for your notice! This repo actually covers the open source cloudformation command line tool, which is separate from the cfn-bootstrap package that you are referring to.

This may be helpful https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/releasehistory-aws-cfn-bootstrap.html

If you have further questions please join us on AWS CloudFormation Discord

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws-cfn-bootstrap/cfn-init at master - GitHub
Contribute to mesosphere-backup/aws-cfn-bootstrap development by creating an account ... logging.exception("Unhandled exception during resume: %s", str(e)).
Read more >
Troubleshoot metadata issues on instance in CloudFormation
Issues with EC2 instance metadata in an AWS CloudFormation stack can occur due to the following reasons: The cfn-init helper script isn't ...
Read more >
cfn-init stops working after adding cfn-signal - Stack Overflow
I am trying to execute few powershell commands in ...
Read more >
CFN, UTF8 and Two Days I'll Never Get Back
In case you are unfamiliar with CloudFormation, cfn-init is a program ... 2015-06-12 03:06:59,846 [ERROR] Unhandled exception during build: ...
Read more >
AWS AMI ami-0c7328b3dbb11f540 (Windows_Server-2012 ...
2022-07-15 13:43:32,501 [ERROR] Unhandled exception during build: [Errno ... (most recent call last): File "cfn-init", line 176, in <module> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found