Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Ansible process crashed while fetching secrets from the 'infisical' instance. #1

Open
ku9nov opened this issue Nov 30, 2023 · 4 comments

Comments

@ku9nov
Copy link
Contributor

ku9nov commented Nov 30, 2023

On a MacBook with an ARM architecture, I can't fetch secrets from the 'infisical' instance.

Example code:

- name: Fetch secrets
  hosts: localhost
  gather_facts: true
  vars:
    read_all_secrets_within_scope: "{{ lookup('infisical.vault.read_secrets', token='<token_here>', path='/', env_slug='dev', url='https://ifc.self.managed') }}"

  tasks:
    - debug:
        var: read_all_secrets_within_scope

Actual output:

TASK [debug] **************************************************************************************************************
objc[54912]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[54912]: +[__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

How to fix it

Run this command in the current terminal session:
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
Now it's working:

TASK [debug] **************************************************************************************************************
ok: [localhost] => {
    "read_all_secrets_within_scope": [
        {
            "key": "POSTGRES_PORT",
            "value": "5432"
        },
    ]
}

This issue is reported here because I have never encountered this problem with other Ansible collections.

@flowerysong
Copy link

This is a known issue with running Ansible on macOS, not anything to do with any specific Ansible content. See https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#running-on-macos-as-a-control-node

@Adamlb
Copy link

Adamlb commented May 18, 2024

I am having a similar issue but export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES has not solved it.

It removes these lines

objc[54912]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[54912]: +[__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.

But I still get

Loading collection infisical.vault from /Users/username/.ansible/collections/ansible_collections/infisical/vault
ERROR! A worker was found in a dead state

I'm trying to debug but I'm a bit of an ansible noob.

Loading collection infisical.vault from /Users/adamblack/.ansible/collections/ansible_collections/infisical/vault
 26381 1716068386.14346: Loaded config def from plugin (lookup/ansible_collections.infisical.vault.plugins.lookup.read_secrets)
 26381 1716068386.14352: Loading LookupModule 'ansible_collections.infisical.vault.plugins.lookup.read_secrets' from /Users/adamblack/.ansible/collections/ansible_collections/infisical/vault/plugins/lookup/read_secrets.py
 25993 1716068386.45188: RUNNING CLEANUP
ERROR! A worker was found in a dead state

@Adamlb
Copy link

Adamlb commented May 18, 2024

I am having a similar issue but export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES has not solved it.

It removes these lines

objc[54912]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[54912]: +[__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.

But I still get

Loading collection infisical.vault from /Users/username/.ansible/collections/ansible_collections/infisical/vault
ERROR! A worker was found in a dead state

I'm trying to debug but I'm a bit of an ansible noob.

Loading collection infisical.vault from /Users/adamblack/.ansible/collections/ansible_collections/infisical/vault
 26381 1716068386.14346: Loaded config def from plugin (lookup/ansible_collections.infisical.vault.plugins.lookup.read_secrets)
 26381 1716068386.14352: Loading LookupModule 'ansible_collections.infisical.vault.plugins.lookup.read_secrets' from /Users/adamblack/.ansible/collections/ansible_collections/infisical/vault/plugins/lookup/read_secrets.py
 25993 1716068386.45188: RUNNING CLEANUP
ERROR! A worker was found in a dead state

I've worked around this by not using this collection, and just using the built-in ansible uri module to query the api manually.

@flowerysong
Copy link

See also ansible/ansible#80109 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants