# Playbook randomly dies after async/poll

**URL:** <https://forum.ansible.com/t/playbook-randomly-dies-after-async-poll/20632>\
**Category:** Ansible Project\
**Created:** [February 19, 2016, 2:05pm UTC](https://forum.ansible.com/t/playbook-randomly-dies-after-async-poll/20632 "2016-02-19T14:05:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg\_Gilbert](https://avatars.discourse-cdn.com/v4/letter/g/a698b9/32.png) [@Greg\_Gilbert](https://forum.ansible.com/u/Greg_Gilbert)\
**Post date:** [February 19, 2016, 2:05pm UTC](https://forum.ansible.com/t/playbook-randomly-dies-after-async-poll/20632/1 "2016-02-19T14:05:07Z")

</div>

Hey. I’m having an issue in Ansible 1.9.4 where a playbook just stops running. No errors or anything, the process just dies. It seems to happen at random places when running the playbook, but it all seems to happen after these two steps:

- name: Fire async to watch build  
shell: “CONTAINER=my\_{{ timestamp }} /app/deploy/watch-docker.sh”  
async: 1200  
poll: 15  
register: watch\_docker  
ignore\_errors: true

- name: Wait until built  
async\_status:  
jid: “{{ watch\_docker.ansible\_job\_id }}”  
register: job\_result  
until: job\_result.finished  
retries: 100  
delay: 15  
ignore\_errors: true

Is it possible that after the async shell call, the process dies on the next poll? Turning on verbose didn’t seem to help. I also tried raising the timeout to 30 in ansible.cfg, but that also did nothing. If I take out these two actions and replace them with a pause action, the playbook completes. Any ideas? I’m pretty stuck on this one…

For reference, here’s the watch-docker script:

// watch-docker.sh  
#!/bin/bash  
if [! -z $CONTAINER]; then  
while true; do  
docker exec $CONTAINER pgrep php5-fpm  
catch=$?  
if [$catch -eq 0]; then  
break  
fi  
sleep 5  
done  
fi  
exit 0

---

<div class="post-metadata">

**Author:** ![Greg\_Gilbert](https://avatars.discourse-cdn.com/v4/letter/g/a698b9/32.png) [@Greg\_Gilbert](https://forum.ansible.com/u/Greg_Gilbert)\
**Post date:** [February 19, 2016, 5:04pm UTC](https://forum.ansible.com/t/playbook-randomly-dies-after-async-poll/20632/2 "2016-02-19T17:04:36Z")

</div>

Update: I think it has to do with the poll: 15 in the first task. Setting that to **0** seems to make it work. Why is the polling there causing an issue?

---

<div class="post-metadata">

**Author:** ![Jakov\_Sosic](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@Jakov\_Sosic](https://forum.ansible.com/u/Jakov_Sosic)\
**Post date:** [August 12, 2016, 1:43pm UTC](https://forum.ansible.com/t/playbook-randomly-dies-after-async-poll/20632/3 "2016-08-12T13:43:05Z")

</div>

Because if you use poll \> 0 then job finishes before the next task starts so I guess `watch_docker` register doesn't contain `ansible_job_id` property?

If you set it to 0, then job runs in background.
