ansible-community / ansible.content_builder

A collection to scaffold Ansible plugins.
GNU General Public License v3.0
31 stars 24 forks source link

Python 3.12.2 crash on macOS 14.4.1 when attempting to run against AWS #86

Open jamesfreeman959 opened 3 months ago

jamesfreeman959 commented 3 months ago
SUMMARY

When attempting to run Ansible Content Builder to build against AWS using the example code, Python crashes

ISSUE TYPE
COMPONENT NAME

ansible.content_builder.module_openapi_cloud

ANSIBLE VERSION
ansible [core 2.16.5]
  config file = /Users/james/Development/ansible-content-builder-demo/ansible.cfg
  configured module search path = ['/Users/james/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/james/Development/ansible-content-builder-demo/.venv/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/james/Development/ansible-content-builder-demo/collections/ansible_collections
  executable location = /Users/james/Development/ansible-content-builder-demo/.venv/bin/ansible
  python version = 3.12.2 (main, Feb  6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)] (/Users/james/Development/ansible-content-builder-demo/.venv/bin/python3.12)
  jinja version = 3.0.3
  libyaml = True
CONFIGURATION
COLLECTIONS_PATHS(/Users/james/Development/ansible-content-builder-demo/ansible.cfg) = ['/Users/james/Development/ansible-content-builder-demo/col>
CONFIG_FILE() = /Users/james/Development/ansible-content-builder-demo/ansible.cfg
PAGER(env: PAGER) = less
OS / ENVIRONMENT

macOS 14.4.1 (on M1 CPU) Python 3.12.2 installed via Homebrew Ansible installed via pip in a virtual environment

STEPS TO REPRODUCE
$ cat hosts
[builder]
localhost

[builder:vars]
ansible_python_interpreter=./.venv/bin/python3
ansible_connection=local

$ cat build.yaml                                                                                                                               ─╯
---
- hosts: localhost
  gather_facts: yes
  vars:
    ansible_python_interpreter: ./.venv/bin/python3

  pre_tasks:
    - debug:
        var: ansible_python_interpreter

  roles:
    - ansible.content_builder.run

$ cat MANIFEST.yaml                                                                                                                            ─╯
---
collection:
  path: ./collections/ansible_collections/amazon/cloud
  namespace: amazon
  name: cloud
plugins:
  - type: module_openapi
    name: "amazon_cloud"
    content: cloud
    api_object_path: api_specifications
    # plugin:resource: API resource. When plugin:content is set to cloud this parameter is set to the path of modules.yaml from module_openapi_cloud
    resource: ./collections/ansible_collections/ansible/content_builder/roles/module_openapi_cloud/files/
    action: generate_all
    unique_key: ""
    rm_swagger_json: ""
    module_version: "1.0.0"
    author: "Ansible Cloud Team"
EXPECTED RESULTS

Content Builder should run successfully

ACTUAL RESULTS
TASK [Generate cloud content] *********************************************************************************************************************
task path: /Users/james/Development/ansible-content-builder-demo/collections/ansible_collections/ansible/content_builder/roles/module_openapi/tasks/main.yaml:7

TASK [ansible.content_builder.module_openapi_cloud : Generate schema for "cloud"] *****************************************************************
task path: /Users/james/Development/ansible-content-builder-demo/collections/ansible_collections/ansible/content_builder/roles/module_openapi_cloud/tasks/main.yaml:2
Collecting Schema
AWS::Backup::BackupVault
objc[78638]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[78638]: +[__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.
ERROR! A worker was found in a dead state
jamesfreeman959 commented 3 months ago

Just a quick update - I've repeated the same tests, using the same virtual environment build on Ubuntu 22.04 with Python 3.10 and the fork error seen does not occur. I haven't had time yet to test with a newer Python version, but just wanted to feed this back in case it's useful.