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 for text file busy error for custom-script-extension binary #153

Merged
merged 6 commits into from
Oct 7, 2019

Conversation

D1v38om83r
Copy link
Collaborator

Fix for text file busy custom-script-extension binary.
Use the shim file to detect open file handles to custom-script-extension binary, and kill the processes that own them before attempting to execute the binary.

echo "${lsof_output}"
echo "attempting to kill processes with open file handles to ${HANDLER_BIN}"
# suppress output and errors in case process with file-handle is already dead and kill gets called without a process id
lsof -t ${bin} | xargs kill -9 > /dev/null 2>&1
Copy link

Choose a reason for hiding this comment

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

Given that this appears to be a race condition, I'm not sure we should do anything but log and add a bit of retry/wait logic here. There was speculation that waagent may be holding up the file - we don't want to kill that or any other critical process.

Copy link

Choose a reason for hiding this comment

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

For now, let's hold off on killing any processes and see if the retries fix the problem. With this change, we'll also gather data about which processes are the culprits.

Comment on lines 56 to 63
while (( retry_attempts < 3 )); do
lsof_output="$(lsof ${bin})"
if [ "$?" -eq 0 ]; then
echo "${HANDLER_BIN} is open by the following processes: "
echo "${lsof_output}"
((++retry_attempts))
echo "sleeping for 30 seconds before retry, attempt ${retry_attempts} of 3"
sleep 30
Copy link

Choose a reason for hiding this comment

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

Increase the maximum retry attempts and decrease the interval between them (10 attempts, 5 seconds between?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants