<p dir="auto">In the 1.9 branch (including whats in the centos 6 repo) in the Runner class, it appears ansible is trying to duplicate the fileno for a new stdin, however, this introduces a file descriptor leak since the dup is never closed.</p>
<p dir="auto">Additionally, self._new_stdin is not used anywhere else in this class.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" self._new_stdin = new_stdin
            if not new_stdin and fileno is not None:
                try:
                    self._new_stdin = os.fdopen(os.dup(fileno))
                except OSError, e:
                    # couldn't dupe stdin, most likely because it's
                    # not a valid file descriptor, so we just rely on
                    # using the one that was passed in
                    pass"><pre class="notranslate"><code class="notranslate"> self._new_stdin = new_stdin
            if not new_stdin and fileno is not None:
                try:
                    self._new_stdin = os.fdopen(os.dup(fileno))
                except OSError, e:
                    # couldn't dupe stdin, most likely because it's
                    # not a valid file descriptor, so we just rely on
                    # using the one that was passed in
                    pass
</code></pre></div>
<p dir="auto">In stable-1.9/lib/ansible/runner/<strong>init</strong>.py#L582</p>
<p dir="auto">This file descriptor leaks one fd for each.</p>
<p dir="auto">It appears in the master branch as well, only its is being used by the TaskExecutor.  However, since its not being closed, it will be a file descriptor leak there as well.</p>
<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible --version
ansible 2.2.0 (devel 3b3ab605f6) last updated 2016/06/13 13:46:21 (GMT -500)
  lib/ansible/modules/core: (detached HEAD d6f01d0b4f) last updated 2016/06/13 10:41:06 (GMT -500)
  lib/ansible/modules/extras: (detached HEAD 43760b2c4a) last updated 2016/06/13 10:41:06 (GMT -500)
  config file = /Users/tanner/projects/ansible.git/playbooks.git/ansible.cfg
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">$ ansible --version
ansible 2.2.0 (devel 3b3ab605f6) last updated 2016/06/13 13:46:21 (GMT -500)
  lib/ansible/modules/core: (detached HEAD d6f01d0b4f) last updated 2016/06/13 10:41:06 (GMT -500)
  lib/ansible/modules/extras: (detached HEAD 43760b2c4a) last updated 2016/06/13 10:41:06 (GMT -500)
  config file = /Users/tanner/projects/ansible.git/playbooks.git/ansible.cfg
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<p dir="auto">ANSIBLE_KEEP_REMOTE_FILES=1</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">Management host OX 10.11.5<br>
Managed host Windows 7</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">Results from task show the log is always "", even when a package is uninstalled</p>
<p dir="auto">changed: [win7-90day] =&gt; {"changed": true, "invocation": {"module_name": "win_msi"}, "log": ""}</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>


<p dir="auto">{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00} = Microsoft Silverlight</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: remove packages (win_msi)
  win_msi: &gt;
      path=&quot;{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}&quot;
      wait=&quot;True&quot;
      state=&quot;absent&quot;"><pre class="notranslate"><code class="notranslate">- name: remove packages (win_msi)
  win_msi: &gt;
      path="{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00}"
      wait="True"
      state="absent"
</code></pre></div>
<p dir="auto">With Microsoft Silverlight installed</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ANSIBLE_KEEP_REMOTE_FILES=1 ansible-playbook -i customers/testing-servers  --ask-vault-pass windows-workstations.yml
&lt;snip&gt;
changed: [win7-90day] =&gt; {&quot;changed&quot;: true, &quot;invocation&quot;: {&quot;module_name&quot;: &quot;win_msi&quot;}, &quot;log&quot;: &quot;&quot;}
PLAY RECAP *********************************************************************
win7-90day                 : ok=2    changed=1    unreachable=0    failed=0"><pre class="notranslate"><code class="notranslate">$ ANSIBLE_KEEP_REMOTE_FILES=1 ansible-playbook -i customers/testing-servers  --ask-vault-pass windows-workstations.yml
&lt;snip&gt;
changed: [win7-90day] =&gt; {"changed": true, "invocation": {"module_name": "win_msi"}, "log": ""}
PLAY RECAP *********************************************************************
win7-90day                 : ok=2    changed=1    unreachable=0    failed=0
</code></pre></div>
<p dir="auto">Microsoft Silverlight is uninstalled.<br>
Reinstall Microsoft Silverlight<br>
RDP  into win7-90day</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; cd C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-XXXX
&gt; win_msi.ps1
&lt;snip&gt;
{&quot;changed&quot;:true,&quot;log&quot;:&quot;MSI (s) (3C:44) [16:21:00:682]: Final Patch Application Order:\r\nMSI (s) (3C:44) [16:21:00:682]
: {0107D3B1-6348-41E9-89D3-0CC803B3B483} - \r\n=== Logging started: 6/13/2016  16:21:00 ===\r\nAction start 16:21:00:"><pre class="notranslate"><code class="notranslate">&gt; cd C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-XXXX
&gt; win_msi.ps1
&lt;snip&gt;
{"changed":true,"log":"MSI (s) (3C:44) [16:21:00:682]: Final Patch Application Order:\r\nMSI (s) (3C:44) [16:21:00:682]
: {0107D3B1-6348-41E9-89D3-0CC803B3B483} - \r\n=== Logging started: 6/13/2016  16:21:00 ===\r\nAction start 16:21:00:
</code></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">Microsoft Silverlight would be uninstalled and the results log would contain the logfile info like when I run the win_msi.ps1 from the powershell command line</p>
<h5 dir="auto">ACTUAL RESULTS</h5>


<p dir="auto">Empty log in the results</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="changed: [win7-90day] =&gt; {&quot;changed&quot;: true, &quot;invocation&quot;: {&quot;module_name&quot;: &quot;win_msi&quot;}, &quot;log&quot;: &quot;&quot;}"><pre class="notranslate"><code class="notranslate">changed: [win7-90day] =&gt; {"changed": true, "invocation": {"module_name": "win_msi"}, "log": ""}
</code></pre></div>