# Ansible 1.3 Command Module: "OSError: \[Errno 24\] Too many open files"

**URL:** <https://forum.ansible.com/t/ansible-1-3-command-module-oserror-errno-24-too-many-open-files/13504>\
**Category:** Ansible Project\
**Created:** [September 18, 2013, 9:43pm UTC](https://forum.ansible.com/t/ansible-1-3-command-module-oserror-errno-24-too-many-open-files/13504 "2013-09-18T21:43:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Ferrante](https://avatars.discourse-cdn.com/v4/letter/m/e99b99/32.png) [@Matt\_Ferrante](https://forum.ansible.com/u/Matt_Ferrante)\
**Post date:** [September 18, 2013, 9:43pm UTC](https://forum.ansible.com/t/ansible-1-3-command-module-oserror-errno-24-too-many-open-files/13504/1 "2013-09-18T21:43:32Z")

</div>

I started using Ansible 1.3.0, installed via pip, and have a found an issue that went away when I used Ansible 1.2.2 (the version I was previously using) instead. I have gone back to 1.2.2 for increased stability.

I did not see this error every time I used the command module, only in some places, particularly with extracting a tarball and with making or installing. On the commands that it happens to, it happens every time.

Command:  
command: /bin/tar xfz libvorbis-1.3.3.tar.gz chdir=/var/tmp/ansible creates=/var/tmp/ansible/libvorbis-1.3.3

Error:

TASK: [unpack libvorbis-1.3.3] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [[ui.test.net](http://ui.test.net)] =\> Traceback (most recent call last):  
File “/Library/Python/2.7/site-packages/ansible/runner/ **init**.py”, line 382, in \_executor  
exec\_rc = self.\_executor\_internal(host, new\_stdin)  
File “/Library/Python/2.7/site-packages/ansible/runner/ **init**.py”, line 471, in \_executor\_internal  
return self.\_executor\_internal\_inner(host, self.module\_name, self.module\_args, inject, port, complex\_args=complex\_args)  
File “/Library/Python/2.7/site-packages/ansible/runner/ **init**.py”, line 654, in \_executor\_internal\_inner  
result = handler.run(conn, tmp, module\_name, module\_args, inject, complex\_args)  
File “/Library/Python/2.7/site-packages/ansible/runner/action\_plugins/normal.py”, line 54, in run  
return self.runner.\_execute\_module(conn, tmp, module\_name, module\_args, inject=inject, complex\_args=complex\_args)  
File “/Library/Python/2.7/site-packages/ansible/runner/ **init**.py”, line 290, in \_execute\_module  
(remote\_module\_path, module\_style, shebang) = self.\_copy\_module(conn, tmp, module\_name, args, inject, complex\_args)  
File “/Library/Python/2.7/site-packages/ansible/runner/ **init**.py”, line 845, in \_copy\_module  
self.\_transfer\_str(conn, tmp, module\_name, module\_data)  
File “/Library/Python/2.7/site-packages/ansible/runner/ **init**.py”, line 256, in \_transfer\_str  
conn.put\_file(afile, remote)  
File “/Library/Python/2.7/site-packages/ansible/runner/connection\_plugins/ssh.py”, line 268, in put\_file  
stdout=subprocess.PIPE, stderr=subprocess.PIPE)  
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 679, in **init**  
errread, errwrite)  
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”, line 1120, in \_execute\_child  
errpipe\_read, errpipe\_write = os.pipe()  
OSError: [Errno 24] Too many open files

---

<div class="post-metadata">

**Author:** ![Dag\_Wieers](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@Dag\_Wieers](https://forum.ansible.com/u/Dag_Wieers)\
**Post date:** [September 18, 2013, 9:59pm UTC](https://forum.ansible.com/t/ansible-1-3-command-module-oserror-errno-24-too-many-open-files/13504/2 "2013-09-18T21:59:37Z")

</div>

Try increasing the number of open files (nofile). Look at the "ulimit -a" output. Then add something like below to /etc/security/limits.d/99-nofile.conf:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\* soft nofile 10240

Test again by re-login to the system with the user having this problem.

(Feel free to replace \* with the user that requires this change, and 10240 with something more suitable for your environment, maybe unlimited)

Kind regards,

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [September 18, 2013, 10:11pm UTC](https://forum.ansible.com/t/ansible-1-3-command-module-oserror-errno-24-too-many-open-files/13504/3 "2013-09-18T22:11:17Z")

</div>

Incidentally I believe we have a pull request for a fix to pty handling that should address most of this.

It’s in queue for testing:

[https://github.com/ansible/ansible/pull/4132](https://github.com/ansible/ansible/pull/4132)

---

<div class="post-metadata">

**Author:** ![Matt\_Ferrante](https://avatars.discourse-cdn.com/v4/letter/m/e99b99/32.png) [@Matt\_Ferrante](https://forum.ansible.com/u/Matt_Ferrante)\
**Post date:** [September 19, 2013, 2:51pm UTC](https://forum.ansible.com/t/ansible-1-3-command-module-oserror-errno-24-too-many-open-files/13504/4 "2013-09-19T14:51:30Z")

</div>

That pull request looks like it would do the trick. The max number of files I have is 100000, that should be sufficient to do a lot, I wouldn’t expect to have to raise it any further.
