macOS: [__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
Seen on macOS 10.15 builds with Ansible 2.10 and Ansible 3; after configuring
[defaults]
force_valid_group_names = ignore
PLAY [integration/ssh/variables.yml] *******************************************
TASK [ansible_ssh_user _raw_params=ANSIBLE_ANY_ERRORS_FATAL=false ANSIBLE_STRATEGY=mitogen_linear ANSIBLE_SSH_ARGS="" ansible -m shell -a whoami -i "{{MITOGEN_INVENTORY_FILE}}" test-targets -e ansible_ssh_user=mitogen__has_sudo -e ansible_ssh_pass=has_sudo_password
, chdir=../..] ***
changed: [target]
TASK [shell _raw_params=ANSIBLE_ANY_ERRORS_FATAL=false ANSIBLE_STRATEGY=mitogen_linear ANSIBLE_SSH_ARGS="" ansible -m shell -a whoami -i "{{MITOGEN_INVENTORY_FILE}}" test-targets -e ansible_ssh_user=mitogen__has_sudo -e ansible_ssh_pass=wrong_password
, chdir=../..] ***
fatal: [target]: FAILED! => changed=true
ansible_facts:
discovered_interpreter_python: /usr/bin/python
cmd: |-
ANSIBLE_ANY_ERRORS_FATAL=false ANSIBLE_STRATEGY=mitogen_linear ANSIBLE_SSH_ARGS="" ansible -m shell -a whoami -i "/Users/runner/work/1/s/tests/ansible/hosts" test-targets -e ansible_ssh_user=mitogen__has_sudo -e ansible_ssh_pass=wrong_password
delta: '0:01:27.893248'
end: '2022-07-16 16:53:27.319507'
msg: non-zero return code
rc: 1
start: '2022-07-16 16:51:59.426259'
stderr: |-
/Users/runner/work/1/s/.tox/py27-mode_localhost-ansible3/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
from cryptography.exceptions import InvalidSignature
objc[15264]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[15264]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
Fatal Python error: Aborted
e.g. from https://dev.azure.com/mitogen-hq/mitogen/_build/results?buildId=377&view=results py27-mode_localhost-ansible2.10-macos1015.log
I don't recall seeing it with Mitogen alone, on Mitogen + Ansible and purportedly Vanilla Ansible jobs. However I'm suspicious of the so-called vanilla ones, they should be skipping this task, based on when: is_mitogen.
Low priority for now because macOS 10.15 build images are being removed by Azure shortly (#939).
The error message may point to wider problem on macOS, with Mitogen using fork()/exec(). Or it might be an Ansible problem, or an ANsible+Mitogen interaction.
Further reading
- https://github.com/python/cpython/issues/77906
- https://github.com/ansible/ansible/issues/76631
- https://stackoverflow.com/questions/50168647/multiprocessing-causes-python-to-crash-and-gives-an-error-may-have-been-in-progr
There are probably other incidental changes (to Python, Ansible, Mitogen, or macOS) that would trigger the same error or similar