-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Could not make dir ~/.ansible/cp after upgrade to 1.2.3 #3943
Comments
Thanks, I'll take a look into this. |
Thanks for the report. What OS are you using BTW? Anything useful to share about the server setup we should know (NFS home, permissions, etc?) |
OS is Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-49-generic-pae i686) Server has only local disks. Permissions appear okay:
Environment was augmented with the supplied script:
I could setup another user with a clean Ansible 1.2.3 installation, if that would help. |
Are you running the ansible command via sudo? |
No, I am running the ansible command without sudo: Ansible is installed (with git by me) in my personal directory /home/joel/ansible, not in any system directory such as /opt or /usr/local. |
This appears to be a race condition where the multiple forked connections are all trying to create the directory at the same time. I wrote this patch, which appears to correct the issue, if you'd like to give it a test: |
I applied the patch and ran ansible as before: Next, I deleted /home/joel/.ansible/cp and its contents. I ran ansible again. Ansible ran fine and created /home/joel/.ansible/cp. I tried a few more cycles of deleting the cp directory and running ansible. No problems were encountered. Of course, my limited testing does not prove that the race condition is fixed. As I reviewed the code changes in the patch, I wondered what would happen if the call to utils.prepare_writeable_dir failed. Would the still-locked process lockfile cause some problem? To test this, I deleted /home/joel/.ansible/cp again and removed write permission from /home/joel/.ansible. Then I reran ansible.
Ansible attempted to create /home/joel/.ansible/cp twice. Looking at the stack traces, I suspect that the process lockfile was released each time sys.exit was called. The lockfile caused the two processes to take turns attempting to create /home/joel/.ansible/cp. That is the desired behavior. After my test, I corrected the write permission on /home/joel/.ansible and ran the ansible command again to confirm that no harm was done. It ran just fine. |
Excellent, thanks for confirming. @mpdehaan and I had also discussed adding a bit more error catching to that function to ignore the case where the directory already existed, however not being writeable I think should still be an error that halts things (I also committed a patch earlier that handles that error cleanly rather than resulting in a stack dump). |
Thanks for the quick solution. |
I upgraded Ansible from release 1.2 to 1.2.3 and ran a playbook that had been working well.
Ansible displayed a Python stack trace while gathering facts and then continued processing only one of the two hosts.
At that point, I terminated Ansible with a control-c. Then I examined the suspect directory.
Seeing no obvious problems, I tried running Ansible again. This time it processed both hosts and reported no stack trace.
A search of Ansible issues found no similar problems, so I am reporting it.
The text was updated successfully, but these errors were encountered: