You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
plays with many hosts fail with too many open files error on macOS #549
Are you running with any custom modules, or module_utils loaded?
No
Have you tried the latest master version from Git?
Yes
Do you have some idea of what the underlying problem may be? https://mitogen.rtfd.io/en/stable/ansible.html#common-problems has
instructions to help figure out the likely cause and how to gather relevant
logs.
I have no problem when I do it to one host. With -f 1 it worked till host 48 and then all hosts failed with
This is vaguely related to #470. How many hosts are you targeting?
It's not mentioned in the docs anywhere, and I simply haven't had a chance to add a (simple) error message for it yet. Quite a lot of file descriptors are currently required
Increase your ulimit -n to at least 32 + 8 + (2 * number of hosts), and preferably double that again.
Reacted by Rafik Farhad, LukasAuerbeck and amit777
This happens for two reasons, the first already mentioned: due to some messy internal handling that is very subtle to fix without breaking stuff, we currently use 2 file descriptors for every connection. It's "simple" to fix this, but anything relating to changing file descriptor lifecycle must be done very carefully :)
The second reason is because unlike with normal Ansible, there is a single process that really has connections to every machine, and file descriptor limits are per-process, not per-user. In normal Ansible, those descriptors are usually spread out across many child tasks, but for that reason, Ansible cannot keep the connections it creates open across the lifetime of a single task
I've started adding hints for the most easy to reproduce cases, but there is no central place where all possible file limit errors can be trapped -- they happen all over the Python standard library, for example.
I've also added a change to automatically increase the Ansible run's soft file limit to the configured hard limit. At least on distributions like Ubuntu, the default soft limit is 1024 while the default hard limit is closer to 1 million. That should drastically cut down on the number of users who ever bump into this.
Activity
dw commentedon Feb 21, 2019
This is vaguely related to #470. How many hosts are you targeting?
It's not mentioned in the docs anywhere, and I simply haven't had a chance to add a (simple) error message for it yet. Quite a lot of file descriptors are currently required
Increase your
ulimit -nto at least32 + 8 + (2 * number of hosts), and preferably double that again.dw commentedon Feb 21, 2019
This happens for two reasons, the first already mentioned: due to some messy internal handling that is very subtle to fix without breaking stuff, we currently use 2 file descriptors for every connection. It's "simple" to fix this, but anything relating to changing file descriptor lifecycle must be done very carefully :)
The second reason is because unlike with normal Ansible, there is a single process that really has connections to every machine, and file descriptor limits are per-process, not per-user. In normal Ansible, those descriptors are usually spread out across many child tasks, but for that reason, Ansible cannot keep the connections it creates open across the lifetime of a single task
peshay commentedon Mar 1, 2019
Yes, thanks! Setting the ulimit -n higher helped.
dw commentedon Mar 1, 2019
Going to keep this open for now as a reminder to add a useful error hint! Thanks for reporting this
issue #549: increase open file limit automatically if possible
issue #549: docs: update Changelog
dw commentedon Jul 31, 2019
I've started adding hints for the most easy to reproduce cases, but there is no central place where all possible file limit errors can be trapped -- they happen all over the Python standard library, for example.
I've also added a change to automatically increase the Ansible run's soft file limit to the configured hard limit. At least on distributions like Ubuntu, the default soft limit is 1024 while the default hard limit is closer to 1 million. That should drastically cut down on the number of users who ever bump into this.
Thanks again for reporting!
Merge remote-tracking branch 'origin/549-open-files'
issue #549: fix setrlimit() crash and hard-wire OS X default
issue #549: remove Linux-specific assumptions from create_child_test
issue #549: skip Docker tests if Docker is unavailable
issue #549 / [stream-refactor]: fix close/poller deregister crash on OSX
Merge remote-tracking branch 'origin/osx-ci-fixes'
issue #549: ansible: reduce risk by capping RLIM_INFINITY
Merge remote-tracking branch 'origin/dmw'