ERROR! Unexpected Exception, this is probably a bug: unhashable type: 'dict'

1,482 views
Skip to first unread message

timoth...@plexresearch.com

unread,
Jan 23, 2018, 1:15:43 PM1/23/18
to Ansible Project
Running Ansible 2.4.2.0 on OSX 10.13.2 (via macports), python version 3.6.4.

I'm running a playbook of some 100-odd tasks and this error occurs at some point in that operation.  I can repeatedly run the playbook and get successively closer to the end.

Some operations must run; if everything is skipped then no error occurs.  The stack trace usually seems to point to a handler, but I can't spot the error.

With "-vvv":

the full traceback was:
Traceback (most recent call last):
  File "/opt/local/bin/ansible-playbook", line 106, in <module>
    exit_code = cli.run()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/cli/playbook.py", line 130, in run
    results = pbex.run()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/executor/playbook_executor.py", line 154, in run
    result = self._tqm.run(play=play)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/executor/task_queue_manager.py", line 290, in run
    play_return = strategy.run(iterator, play_context)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/plugins/strategy/linear.py", line 292, in run
    results += self._wait_on_pending_results(iterator)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/plugins/strategy/__init__.py", line 586, in _wait_on_pending_results
    results = self._process_pending_results(iterator)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/plugins/strategy/__init__.py", line 470, in _process_pending_results
    if handler_name in self._listening_handlers:
TypeError: unhashable type: 'dict'


It would seem that the error is happening when notifications are collected, e.g. one task after which the failure occurs.  Note that this is one task in the middle of several which do the "notify":

- name: install hiredis 0.13 shared library
  become: yes
  copy: src={{ item.src }} dest={{ item.dest }} mode={{ item.mode }}
  with_items:
    - { src: "libhiredis.so.0.13", dest: "/usr/lib64/", mode: '0755' }
  tags: provision, hiredis, redis_fdw
  notify:
    - name: restart postgres

The handler definition:

---
- name: restart postgres
  become: yes
  service: name="{{ pg_service }}" state=restarted
- name: reload sysctl configuration
  become: yes
  shell: sysctl -p /etc/sysctl.conf

Matt Martz

unread,
Jan 23, 2018, 2:16:26 PM1/23/18
to ansible...@googlegroups.com
You need to drop the `name: ` from your `notify`:

```
notify:
    - restart postgres
```

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c80ee46d-edcb-4d7f-8bd3-99de620df508%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net

Tim Wall

unread,
Jan 23, 2018, 2:51:40 PM1/23/18
to ansible...@googlegroups.com

Thanks!  I was totally blind to that...


From: ansible...@googlegroups.com <ansible...@googlegroups.com> on behalf of Matt Martz <ma...@sivel.net>
Sent: Tuesday, January 23, 2018 2:15:31 PM
To: ansible...@googlegroups.com
Subject: Re: [ansible-project] ERROR! Unexpected Exception, this is probably a bug: unhashable type: 'dict'
 
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/6aqZBCG6I8k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v-rmOtBT8-5DOs6sz-kUctO296DHvT6U0Lks7t1BRtzdA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages