Commit a017583e authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

grid: launch supervisord with bigger FILENO soft limit

parent 9f406e6e
......@@ -63,7 +63,7 @@ setup(name=name,
'netaddr>=0.7.5', # to play safely with IPv6 prefixes
'netifaces', # to fetch information about network devices
'setuptools', # namespaces
'supervisor', # slapgrid uses supervisor to manage processes
'supervisor>=3.3.0', # slapgrid uses supervisor to manage processes
'psutil>=2.0.0',
'xml_marshaller>=0.9.3', # to unmarshall/marshall python objects to/from
# XML
......@@ -75,6 +75,7 @@ setup(name=name,
'cachecontrol',
'lockfile',
'uritemplate', # used by hateoas navigator
'resource',
'subprocess32; python_version<"3"'
] + additional_install_requires,
extras_require=extras_require,
......
......@@ -31,6 +31,7 @@
import os
import pkg_resources
import socket as socketlib
import resource
import subprocess
import stat
import sys
......@@ -175,7 +176,10 @@ def launchSupervisord(instance_root, logger,
supervisord_argument_list = ['-c', configuration_file]
if supervisord_additional_argument_list is not None:
supervisord_argument_list.extend(supervisord_additional_argument_list)
def preexec_fn():
cur_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
new_limit = (cur_limit[1], cur_limit[1]) # set the soft limit to the hard limit
resource.setrlimit(resource.RLIMIT_NOFILE, new_limit)
logger.info("Launching supervisord with clean environment.")
# Extract python binary to prevent shebang size limit
invocation_list = [sys.executable, '-c']
......@@ -188,7 +192,8 @@ def launchSupervisord(instance_root, logger,
env={},
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
logger=logger)
logger=logger,
preexec_fn=preexec_fn)
result = supervisord_popen.communicate()[0]
if supervisord_popen.returncode:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment