mitogen-hq / mitogen

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

ModuleNotFoundError: 'mmap' is present in the Mitogen importer blacklist #1103

Open ondrejkopka opened 3 months ago

ondrejkopka commented 3 months ago

this task:

- name: wait for port 53 to be open on localhost
  wait_for:
    host: localhost
    port: 53
    state: started
    timeout: 120

leads to this error:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: 'mmap' is present in the Mitogen importer blacklist, therefore this context will not attempt to request it from the master, as the request will always be refused.
fatal: [host]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"master:/opt/mitogen/ansible_mitogen/runner.py\", line 1056, in _run\n    self._run_code(code, mod)\n  File \"master:/opt/mitogen/ansible_mitogen/runner.py\", line 1020, in _run_code\n    exec(code, vars(mod))\n  File \"master:/home/tom/.local/lib/python3.10/site-packages/ansible/modules/wait_for.py\", line 231, in <module>\n  File \"<stdin>\", line 1627, in create_module\n  File \"<stdin>\", line 1548, in _refuse_imports\nModuleNotFoundError: 'mmap' is present in the Mitogen importer blacklist, therefore this context will not attempt to request it from the master, as the request will always be refused.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
moreati commented 3 months ago

Sorry for the wait. I wasn't able to to reproduce this error, with the following

- hosts: localhost
  vars:
    ansible_python_interpreter: /usr/bin/python3.11
  tasks:
    - wait_for:
        host: localhost
        port: 22
        state: started
        timeout: 5
root@u2204:~# python3.9 -mvenv v39
root@u2204:~# v39/bin/pip install ansible ansible-core==2.15.8 mitogen
root@u2204:~# ANSIBLE_STRATEGY=mitogen_linear ANSIBLE_STRATEGY_PLUGINS=v39/lib/python3.9/site-packages/ansible_mitogen/plugins/strategy/ v39/bin/ansible-playbook issue1103_repro.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [localhost] ****************************************************************************************************

TASK [Gathering Facts] **********************************************************************************************
ok: [localhost]

TASK [wait_for] *****************************************************************************************************
ok: [localhost]

PLAY RECAP **********************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

OS is Ubuntu 22.04 in a Proxmox LXC container, with Pythons installed from Deadsnakes repo.

root@u2204:~# uname -a
Linux u2204 6.8.4-3-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.4-3 (2024-05-02T11:55Z) x86_64 x86_64 x86_64 GNU/Linux
root@u2204:~# v39/bin/python --version; v39/bin/pip list
Python 3.9.19
Package             Version
------------------- -------
ansible             8.7.0
ansible-core        2.15.8
cffi                1.17.0
cryptography        43.0.0
importlib-resources 5.0.7
Jinja2              3.1.4
MarkupSafe          2.1.5
mitogen             0.3.9
packaging           24.1
pip                 23.0.1
pycparser           2.22
PyYAML              6.0.2
resolvelib          1.0.1
setuptools          58.1.0

[notice] A new release of pip is available: 23.0.1 -> 24.2
[notice] To update, run: python3.9 -m pip install --upgrade pip
root@u2204:~# /usr/bin/python3.11 --version
Python 3.11.9