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

Lookup plugin credstash failing #31869

Closed
stijndehaes opened this Issue Oct 18, 2017 · 7 comments

Comments

Projects
None yet
8 participants
@stijndehaes
Copy link

stijndehaes commented Oct 18, 2017

ISSUE TYPE
  • Bug Report
COMPONENT NAME

lookup plugin, credstash

ANSIBLE VERSION
ansible 2.4.0.0
  config file = None
  configured module search path = [u'/Users/stijndehaes/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14 (default, Sep 25 2017, 23:05:11) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]

credstash version: 1.13.4

CONFIGURATION

empty

OS / ENVIRONMENT

Mac OSX High sierra 10.13 (17A405)

SUMMARY

When using the lookup plugin for credstash I get the following error:

TASK [Test credstash lookup plugin -- get the password with a context defined here] ***********************************************************************************************************************************************************************************************
objc[6763]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.
objc[6763]: +[__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.
STEPS TO REPRODUCE
- name: Test
  hosts: localhost
  tasks:
    - name: "Test credstash lookup plugin -- get the password with a context defined here"
      debug: msg="credstash {{ lookup('credstash', 'test', region=aws_region) }}"
  vars:
    aws_region: eu-west-1
EXPECTED RESULTS

It to work

ACTUAL RESULTS
TASK [Test credstash lookup plugin -- get the password with a context defined here] ***********************************************************************************************************************************************************************************************
objc[6763]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.
objc[6763]: +[__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.
@jborean93

This comment has been minimized.

Copy link
Contributor

jborean93 commented Oct 19, 2017

Is This A Bug?

Hi!

Thanks very much for your submission to Ansible. It sincerely means a lot to us.

We're not sure this is a bug, and we don't mean for this to be confrontational. Let's explain what we're thinking:

  • This is an issue with macOS 10.13 where Apple changed the way fork() works on the OS which is incompatible with Python fork().

This guide http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html explains more on what is happening but the end result is to set OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES in your environment variables while waiting for a fix in the relevant Python libraries.

As such, we're going to close this ticket. However, we're open to being corrected, should you wish to discuss. You can stop by one of our two mailing lists
to talk about this and we might be persuaded otherwise.

Comments on closed tickets aren't something we monitor, so if you do disagree with this, a mailing list thread is probably appropriate.

Thank you once again for this and your interest in Ansible!

@jborean93 jborean93 closed this Oct 19, 2017

@jborean93 jborean93 removed the needs_triage label Oct 19, 2017

@mojojoseph

This comment has been minimized.

Copy link

mojojoseph commented Oct 24, 2017

I was Googling high and low for the answer to this one; after upgrading Ansible from 2.3.1 to 2.4.0 on High Sierra I was getting this crash while utilizing the win modules. The export as mentioned above cleared it up.

@mikedlr

This comment has been minimized.

Copy link
Contributor

mikedlr commented Jan 8, 2018

Further comment: this is almost certainly a bug in the python which apple distributes. Apple has changed their fork implementation to disallow forking with active threads. Taking the latest python distributed from python.org seems to fix this error without needing to set the environment variable (tested on python 3.6).

@C-Kenny

This comment has been minimized.

Copy link

C-Kenny commented Feb 13, 2018

Came here from Google after running:

ansible windows -vvv -i hosts -m win_ping

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

Setting:

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

Fixed this for me on High Sierra.

@jonbrenner

This comment has been minimized.

Copy link

jonbrenner commented Sep 18, 2018

This bug is also present in the Homebrew distributed Python 3.7.0 package:

python: stable 3.7.0 (bottled), HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org/
/usr/local/Cellar/python/3.7.0 (4,889 files, 103.5MB) *
  Poured from bottle on 2018-07-17 at 10:46:46
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb

Python 3.7.0 from Python.org works properly.

@wsgzao

This comment has been minimized.

Copy link

wsgzao commented Nov 27, 2018

使用 Ansible 管理 Windows - https://wsgzao.github.io/post/ansible-windows/

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

# run this export
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
@mikedlr

This comment has been minimized.

Copy link
Contributor

mikedlr commented Nov 27, 2018

I want to correct my above comment; I have looked through the use of fork in Ansible. There are multiple cases where something is done after a fork and before an exec. If you read the above articles carefully it is completely possible that this means that a thread is holding an important lock over a fork and can be seen as a "discovered" bug in Ansible.

elasticdog added a commit to elasticdog/dotfiles that referenced this issue Jan 28, 2019

Fix Python forking issue on macOS
Noticed issues specifically with running Ansible and the following error:

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

See: ansible/ansible#31869
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.