mitogen-hq / mitogen

Distributed self-replicating programs in Python
https://mitogen.networkgenomics.com/
BSD 3-Clause "New" or "Revised" License
2.33k stars 197 forks source link

ansible_mitogen.target.run_module get wrong module_params (sometimes) #772

Open igorfraa opened 3 years ago

igorfraa commented 3 years ago

With ansible.builtin.template sometimes "foo.bar/foo.bar.j2" (file in directory) is created instead of "foo.bar" plain file.

I was able to reproduce it three times in two different tasks of a somewhat large execution (36 plays with some hundred tasks). It took about 10 tries. On the next day I was not able to reproduce the issue in 30 tries.

I was not able to reproduce it when execution was limited using tags to just a failing task in 200 tries.

Ansible version is 2.9.15 from PyPi, no custom modules, Mitogen 0.2.9

Example failing task:

- name: copy my.cnf
  template: src=mysql/{{ item }}.j2 dest={{ foo }}/mysql/{{ item }}
  with_items:
    - my.cnf
  tags: mysql
$ ansible-config dump --only-changed
ANSIBLE_FORCE_COLOR(/home/igorfraa/ansible/playbook/ansible.cfg) = True
ANSIBLE_PIPELINING(/home/igorfraa/ansible/playbook/ansible.cfg) = True
ANSIBLE_SSH_ARGS(/home/igorfraa/ansible/playbook/ansible.cfg) = -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s
DEFAULT_CALLBACK_WHITELIST(/home/igorfraa/ansible/playbook/ansible.cfg) = ['profile_tasks']
DEFAULT_HOST_LIST(/home/igorfraa/ansible/playbook/ansible.cfg) = ['/home/igorfraa/ansible/hosts']
DEFAULT_STRATEGY(/home/igorfraa/ansible/playbook/ansible.cfg) = mitogen_linear
DEFAULT_STRATEGY_PLUGIN_PATH(/home/igorfraa/ansible/playbook/ansible.cfg) = ['/home/igorfraa/ansible/playbook/files/mitogen-0.2.9/ansible_mitogen/plugins/strategy']
DEFAULT_TIMEOUT(/home/igorfraa/ansible/playbook/ansible.cfg) = 30
HOST_KEY_CHECKING(/home/igorfraa/ansible/playbook/ansible.cfg) = False
PERSISTENT_CONNECT_TIMEOUT(/home/igorfraa/ansible/playbook/ansible.cfg) = 30

Log for a task: mitogen-cleaned.log

igorfraa commented 3 years ago

Does anybody have an idea of a possible cause of this bug?

I have looked into Ansible sources and parameter parsing/substitution appears simple and straightforward. I do not think that bug could resist in vanilla Ansible itself.

s1113950 commented 3 years ago

At first glance I'm not sure what could be going on here. Please try one of the latest Mitogen releases to see if the issue still persists: v0.2.10rc1 for Ansible < 2.10 v0.3.0rc1 for Ansible 2.10+