# Gathering Facts hangs when using become

**URL:** <https://forum.ansible.com/t/gathering-facts-hangs-when-using-become/31962>\
**Category:** Ansible Project\
**Created:** [January 13, 2020, 11:46pm UTC](https://forum.ansible.com/t/gathering-facts-hangs-when-using-become/31962 "2020-01-13T23:46:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Thro](https://avatars.discourse-cdn.com/v4/letter/c/a88e4f/32.png) [@Chris\_Thro](https://forum.ansible.com/u/Chris_Thro)\
**Post date:** [January 13, 2020, 11:46pm UTC](https://forum.ansible.com/t/gathering-facts-hangs-when-using-become/31962/1 "2020-01-13T23:46:56Z")

</div>

Out of hundreds of hosts we have one host always hangs when gathering facts when using become.

Create a playbook with the following:

- hosts: all

call the playbook with the -b flag

The last thing reported in the log is “Escalation succeeded”.

No matter how long I wait it never returns the prompt and there are two processes running on the remote host. One as my username and one as root.

There is no nfs (I have seen other issues where facts hang on nfs).

This is a RHEL5 host with python 2.7 installed. 1/4 of our hosts are RHEL5 with python 2.7 installed and they don’t have this issue

Anyone see this before? Any ideas how to troubleshoot it further?  
I have tried the highest verbosity but there doesn’t appear to be any helpful information; compared it to successful runs and nothing is different.

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [January 14, 2020, 6:00am UTC](https://forum.ansible.com/t/gathering-facts-hangs-when-using-become/31962/2 "2020-01-14T06:00:20Z")

</div>

Hi,

Problems I already encounter :

- NFS Stale
- rpm database corruption
- lock on lvm

Regards,

Jy

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [January 14, 2020, 6:47am UTC](https://forum.ansible.com/t/gathering-facts-hangs-when-using-become/31962/3 "2020-01-14T06:47:02Z")

</div>

> Out of hundreds of hosts we have one host always hangs when gathering facts  
> when using become.
> 
> Create a playbook with the following:  
> - hosts: all
> 
> call the playbook with the -b flag
> 
> The last thing reported in the log is "Escalation succeeded".  
> No matter how long I wait it never returns the prompt and there are two  
> processes running on the remote host. One as my username and one as root.
> 
> There is no nfs (I have seen other issues where facts hang on nfs).

I almost always IO related, mounts, LVM, filsystem...

> Anyone see this before? Any ideas how to troubleshoot it further?  
> I have tried the highest verbosity but there doesn't appear to be any  
> helpful information; compared it to successful runs and nothing is  
> different.

It happens sometimes and the easiest way(IMHO) to find where it hangs is to debug the setup module  
[https://docs.ansible.com/ansible/latest/dev\_guide/debugging.html#debugging-remote](https://docs.ansible.com/ansible/latest/dev_guide/debugging.html#debugging-remote)

Then I run the module manually as described in the link with strace to identify where it hangs.

---

<div class="post-metadata">

**Author:** ![Chris\_Thro](https://avatars.discourse-cdn.com/v4/letter/c/a88e4f/32.png) [@Chris\_Thro](https://forum.ansible.com/u/Chris_Thro)\
**Post date:** [January 14, 2020, 11:53pm UTC](https://forum.ansible.com/t/gathering-facts-hangs-when-using-become/31962/4 "2020-01-14T23:53:30Z")

</div>

Thank you. I did the strace and it shows that it is just repeating the same two lines over and over again.  
select(7, [4 6], , [4 6], {1, 0}) = 0 (Timeout)  
wait4(29548, 0x7fff6a145c84, WNOHANG, NULL) = 0

When I checked the details of the select I get the following:  
lsof -p 10984 -ad 4,6  
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME  
python2.7 10984 root 4r FIFO 0,7 0t0 819132068 pipe  
python2.7 10984 root 6r FIFO 0,7 0t0 819132069 pipe

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [January 15, 2020, 2:39pm UTC](https://forum.ansible.com/t/gathering-facts-hangs-when-using-become/31962/5 "2020-01-15T14:39:19Z")

</div>

What happens right before it goes into this loop is probably the interesting part and can identifies what it trying to access.  
If not you probably need to add print statements in the python code to identifies where it hangs.

---

<div class="post-metadata">

**Author:** ![Chris\_Thro](https://avatars.discourse-cdn.com/v4/letter/c/a88e4f/32.png) [@Chris\_Thro](https://forum.ansible.com/u/Chris_Thro)\
**Post date:** [January 15, 2020, 11:31pm UTC](https://forum.ansible.com/t/gathering-facts-hangs-when-using-become/31962/6 "2020-01-15T23:31:16Z")

</div>

Thank you for the print idea. I was able to trace it to the following commands:

/usr/bin/facter --puppet –json

Looks like the version of facter doesn’t like the --puppet option. WIll probably have to look into uprading it.

Thanks again.
