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

Python Crashes when using this Plugin in OSX High Sierra #60

Open
ajrgrubbs opened this issue Sep 28, 2017 · 8 comments
Open

Python Crashes when using this Plugin in OSX High Sierra #60

ajrgrubbs opened this issue Sep 28, 2017 · 8 comments

Comments

@ajrgrubbs
Copy link
Contributor

Summary:
Attempting to use this plugin on High Sierra is causing a python crash. Reproduced on both Python 2.7.14 and 3.6.2 (installed with brew). Unable to reproduce with other lookup plugins.

Reproduction:
A simple playbook with a debug step will do:

- hosts: localhost
  tasks:
    - debug:
        msg: "{{ lookup('vault', 'secret/dev/test', 'hello') }}"

Symptoms:
In the terminal which executes this playbook, the output looks like:

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

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

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

Additional notes:
This appears to be due to some low-level objective-C changes introduced in High Sierra. This article (http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html) has more details. It also provides a workaround: Setting the environment variable OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES. Setting this before running ansible provides successful results.

I'll be honest, I have no clue what the "correct" fix is here, or even if it can be made in this plugin (as opposed to ansible or python itself). Mostly I'm documenting this here in case others come across this issue - I hope someone finds this useful. I'm content with using the environment variable for the time being.

@qaisjp
Copy link

qaisjp commented Dec 2, 2017

I get this same error when using the requests API, on High Sierra.

Probably related to this https://bugs.python.org/issue30837

@qaisjp
Copy link

qaisjp commented Dec 2, 2017

ansible/ansible#31869 (comment)

See this solution

(just seen that this solution is mentioned above. wow i should read more)

@mikedlr
Copy link

mikedlr commented Jan 8, 2018

@ajrgrubbs please could you retest using the latest python version from python.org. My testing on a the aws_ssm lookup module seems to show that there is some fix included there.

@mikedlr
Copy link

mikedlr commented Jan 8, 2018

@ajrgrubbs
Copy link
Contributor Author

@mikedlr unfortunately no longer have the means to retest - traded the mac for a PC since I created this issue. My apologies!

@snoby
Copy link

snoby commented Feb 5, 2018

I would also mention that you need to export no_proxy='*' as found on this webpage. Otherwise you will get messages like ERROR! A worker was found in a dead state.
I'm running in macOS 10.13.3 , a python virtualenv with python version 2.7.10 and tip of master.

@z00m1n
Copy link

z00m1n commented Apr 24, 2018

@snoby : That's true, but not related to the issue; I get the worker was found in a dead state issue on macOS 10.12, but the may have been in progress in another thread issue on macOS 10.13.

@alexlopes
Copy link

I would also mention that you need to export no_proxy='*' as found on this webpage. Otherwise you will get messages like ERROR! A worker was found in a dead state. I'm running in macOS 10.13.3 , a python virtualenv with python version 2.7.10 and tip of master.

the first env var stopped working here so setting no_proxy='*' saved me now :), tks!

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

6 participants