-
Notifications
You must be signed in to change notification settings - Fork 33
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
Conversation
misc/custom-script-shim
Outdated
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
misc/custom-script-shim
Outdated
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 |
There was a problem hiding this comment.
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?)
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.