ValueError: filedescriptor out of range in select() - lfbear/ansible-api GitHub Wiki

ValueError: filedescriptor out of range in select()

This is a boresome question if you have hundreds of machines, the reason is python's select module. Though is's high-level, so small size for web.

Refer to https://github.com/Supervisor/supervisor/pull/129, I add a script to solve it.

How to use

  • Install ansible-api normally
  • Find the script in ansible libpath: plugins/connection/ssh.py
  • Add code below:
from ansible.plugins.connection.multipoller import MultiPooler # import a new pooler

# find this line and comment it
# rfd, wfd, efd = select.select(rpipes, [], [], timeout) 
# add codes for solving: filedescriptor out of range in select()
poller = MultiPooler.get()
for rpipe in rpipes:
     poller.register_readable(rpipe)
rfd, wfd = poller.poll(timeout)