ANSIBLE PLAYBOOK IS HANGING/STUCK WITH WAIT4 SYSTEMCALL
I was trying to get Java version in multiple Boomi applications using Ansible script. Wrote a small bash script to get Java version and using that in Ansible to be executed on all Boomi VMs. After printing some output Ansible script seems to be stuck. I verified Ansible output to find if there are any missing hostname from inventroy to quickly idnetify the problematic VM. But all VM hostnames are present in the output file. So, thought to tracing it using strace. Followed below procedure, to identify the problematic VM:
- Find process id of Ansible playbook.
[ansible@ansible-host ~]$ ps -ef | grep ansible-playbook
oracle 105169 100414 9 22:10 pts/1 00:08:24 /usr/bin/python2 /bin/ansible-playbook adhoc.yaml -i hosts
oracle 105987 105169 0 22:10 pts/1 00:00:00 /usr/bin/python2 /bin/ansible-playbook adhoc.yaml -i hosts
- Process with process id 105169 is the parent Ansible process. Ran below strace command to check what this process is waiting on:
strace -ffTy -e ‘trace=!futex,clock_gettime,gettimeofday’ -p 105169
- strace spit out below output:
select(0, NULL, NULL, NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout) <0.001095>
wait4(105987, 0x7ffff1a73a74, WNOHANG, NULL) = 0 <0.000017>
select(0, NULL, NULL, NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout) <0.001096>
wait4(105987, 0x7ffff1a73a74, WNOHANG, NULL) = 0 <0.000026>
select(0, NULL, NULL, NULL, {tv_sec=0, tv_usec=1000}) = 0 (Timeout) <0.001098>
- From the system call wait4, we can say that process is waiting for process, 105987 which is the child process of 105169.
- Next step is to find for what child process, 105987, is waiting for. Again used same strace command but with child process pid. The output is as below.
epoll_wait(10, [], 2, 9926) = 0 <9.936029>
wait4(109441, 0x7ffffd167d84, WNOHANG, NULL) = 0 <0.000008>
- Again this process is waiting for another process with process id: 9926
ansible 9926 109421 0 07:15 pts/0 00:00:00 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=”boomi” -o ConnectTimeout=10 -o ControlPath=/home/oracle/.ansible/cp/9707fbc430 -tt boomi-dev-a1.xyz.com /bin/sh -c ‘ /home/boomi/.ansible/tmp/ansible-tmp-1646061313.82-109421/javaversion.sh && sleep 0’
- This is the process trying to execute the script on boomi-dev-a1.xyz.com and hanging. Ran few commands like df on that machine. It was hanging. Our Linux admin team checked it and found thatthe issue was with NFS mount. After remounting NFS, commands started responding and Ansible playbook too completed successfully.
Comments
Post a Comment