<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto">ansible-playbook</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.2.0
  config file = /ansible/ansible.cfg
  configured module search path = ['/ansible/library', '/usr/share/ansible']
  ansible python module location = /usr/local/lib/python3.5/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118]"><pre class="notranslate"><code class="notranslate">ansible 2.4.2.0
  config file = /ansible/ansible.cfg
  configured module search path = ['/ansible/library', '/usr/share/ansible']
  ansible python module location = /usr/local/lib/python3.5/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">I'm using docker as an environment host in Windows 10. My docker version is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Version 17.09.0-ce-win33 (13620)
Channel: stable
8c56a3b"><pre class="notranslate"><code class="notranslate">Version 17.09.0-ce-win33 (13620)
Channel: stable
8c56a3b
</code></pre></div>
<p dir="auto">The Docker File I use to run the environment:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="FROM debian:stable-slim

RUN apt-get update &amp;&amp; \
  apt-get install -y \
    cowsay \
    mysql-client \
    openssh-client \
    rsync \
    python3 \
    python3-pip \
    python3-mysqldb

RUN pip3 install \
  ansible \
  boto \
  boto3 \
  awscli \
  colorama \
  jmespath \
  passlib

VOLUME &quot;/ansible&quot;
VOLUME &quot;/root/.aws&quot;
WORKDIR &quot;/ansible&quot;"><pre lang="docker" class="notranslate"><code class="notranslate">FROM debian:stable-slim

RUN apt-get update &amp;&amp; \
  apt-get install -y \
    cowsay \
    mysql-client \
    openssh-client \
    rsync \
    python3 \
    python3-pip \
    python3-mysqldb

RUN pip3 install \
  ansible \
  boto \
  boto3 \
  awscli \
  colorama \
  jmespath \
  passlib

VOLUME "/ansible"
VOLUME "/root/.aws"
WORKDIR "/ansible"
</code></pre></div>
<p dir="auto">I then build and then start it up with something like:</p>
<p dir="auto"><code class="notranslate">docker run -it --rm --mount type=bind,source=C:\git\my_ansible,target=/ansible --mount source=C:\Users\Me\.aws,target=/root/.aws ansible</code></p>
<p dir="auto"><code class="notranslate">$root@....&gt; ansible-playbook _test.yaml</code></p>
<p dir="auto">I am also using the "stock" ec2.py dynamic inventory.</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Occasionally simple playbooks explode with a bunch of errors at the end of an invocation</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">This is the playbook that "sometimes" barfs (run it a couple of times)</p>

<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- hosts: localhost
  become: no
  tasks:
  - debug: msg=&quot;{{'a' if what is defined else 'b'}}&quot;"><pre class="notranslate">- <span class="pl-ent">hosts</span>: <span class="pl-s">localhost</span>
  <span class="pl-ent">become</span>: <span class="pl-s">no</span>
  <span class="pl-ent">tasks</span>:
  - <span class="pl-ent">debug</span>: <span class="pl-s">msg="{{'a' if what is defined else 'b'}}"</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="root@2c92f553e7c7:/ansible# ansible-playbook _test.yml -vvvv
ansible-playbook 2.4.2.0
  config file = /ansible/ansible.cfg
  configured module search path = ['/ansible/library', '/usr/share/ansible']
  ansible python module location = /usr/local/lib/python3.5/dist-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118]
Using /ansible/ansible.cfg as config file
setting up inventory plugins
Parsed /ansible/ec2.py inventory source with script plugin
Parsed /ansible/ansible_hosts.ini inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.5/dist-packages/ansible/plugins/callback/__init__.py
 _____________________
&lt; PLAYBOOK: _test.yml &gt;
 ---------------------
1 plays in _test.yml
 __________________
&lt; PLAY [localhost] &gt;
 ------------------
META: ran handlers
 ______________
&lt; TASK [debug] &gt;
 --------------

task path: /ansible/_test.yml:5
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;b&quot;
}
META: ran handlers
META: ran handlers
 ____________
&lt; PLAY RECAP &gt;
 ------------
localhost                  : ok=1    changed=0    unreachable=0    failed=0"><pre class="notranslate"><code class="notranslate">root@2c92f553e7c7:/ansible# ansible-playbook _test.yml -vvvv
ansible-playbook 2.4.2.0
  config file = /ansible/ansible.cfg
  configured module search path = ['/ansible/library', '/usr/share/ansible']
  ansible python module location = /usr/local/lib/python3.5/dist-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118]
Using /ansible/ansible.cfg as config file
setting up inventory plugins
Parsed /ansible/ec2.py inventory source with script plugin
Parsed /ansible/ansible_hosts.ini inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.5/dist-packages/ansible/plugins/callback/__init__.py
 _____________________
&lt; PLAYBOOK: _test.yml &gt;
 ---------------------
1 plays in _test.yml
 __________________
&lt; PLAY [localhost] &gt;
 ------------------
META: ran handlers
 ______________
&lt; TASK [debug] &gt;
 --------------

task path: /ansible/_test.yml:5
ok: [localhost] =&gt; {
    "msg": "b"
}
META: ran handlers
META: ran handlers
 ____________
&lt; PLAY RECAP &gt;
 ------------
localhost                  : ok=1    changed=0    unreachable=0    failed=0
</code></pre></div>
<p dir="auto">Then this is repeated 26 times</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Exception ignored in: &lt;function WeakValueDictionary.__init__.&lt;locals&gt;.remove at 0x7fa5c4a9e950&gt;
Traceback (most recent call last):
  File &quot;/usr/lib/python3.5/weakref.py&quot;, line 117, in remove
TypeError: 'NoneType' object is not callable"><pre class="notranslate"><code class="notranslate">Exception ignored in: &lt;function WeakValueDictionary.__init__.&lt;locals&gt;.remove at 0x7fa5c4a9e950&gt;
Traceback (most recent call last):
  File "/usr/lib/python3.5/weakref.py", line 117, in remove
TypeError: 'NoneType' object is not callable
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">Less ignored exceptions</p>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">ansible-playbook</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.3.0
  config file = /home/…/ansible.cfg
  configured module search path = Default w/o overrides
"><pre class="notranslate"><code class="notranslate">ansible 2.3.0
  config file = /home/…/ansible.cfg
  configured module search path = Default w/o overrides

</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">forks = 100, pipelining = True</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Distributor ID:	Debian
Description:	Debian GNU/Linux 8.7 (jessie)
Release:	8.7
Codename:	jessie"><pre class="notranslate"><code class="notranslate">Distributor ID:	Debian
Description:	Debian GNU/Linux 8.7 (jessie)
Release:	8.7
Codename:	jessie
</code></pre></div>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Sometimes, like once every 10 runs, I'm getting a whole lot of (like 20 times, all have the exact same address):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Exception ignored in: &lt;function WeakValueDictionary.__init__.&lt;locals&gt;.remove at 0x7f51bb741950&gt;
Traceback (most recent call last):
  File &quot;/usr/lib/python3.5/weakref.py&quot;, line 117, in remove
TypeError: 'NoneType' object is not callable"><pre class="notranslate"><code class="notranslate">Exception ignored in: &lt;function WeakValueDictionary.__init__.&lt;locals&gt;.remove at 0x7f51bb741950&gt;
Traceback (most recent call last):
  File "/usr/lib/python3.5/weakref.py", line 117, in remove
TypeError: 'NoneType' object is not callable
</code></pre></div>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">I can reproduce it with a <code class="notranslate">--limit</code> on one host and a <code class="notranslate">--start-at-task</code> with an unexisting task, so the playbook is doing like nothing apart skipping hosts.</p>