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, ...@@ -63,7 +63,7 @@ setup(name=name,
'netaddr>=0.7.5', # to play safely with IPv6 prefixes 'netaddr>=0.7.5', # to play safely with IPv6 prefixes
'netifaces', # to fetch information about network devices 'netifaces', # to fetch information about network devices
'setuptools', # namespaces 'setuptools', # namespaces
'supervisor', # slapgrid uses supervisor to manage processes 'supervisor>=3.3.0', # slapgrid uses supervisor to manage processes
'psutil>=2.0.0', 'psutil>=2.0.0',
'xml_marshaller>=0.9.3', # to unmarshall/marshall python objects to/from 'xml_marshaller>=0.9.3', # to unmarshall/marshall python objects to/from
# XML # XML
...@@ -75,6 +75,7 @@ setup(name=name, ...@@ -75,6 +75,7 @@ setup(name=name,
'cachecontrol', 'cachecontrol',
'lockfile', 'lockfile',
'uritemplate', # used by hateoas navigator 'uritemplate', # used by hateoas navigator
'resource',
'subprocess32; python_version<"3"' 'subprocess32; python_version<"3"'
] + additional_install_requires, ] + additional_install_requires,
extras_require=extras_require, extras_require=extras_require,
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
import os import os
import pkg_resources import pkg_resources
import socket as socketlib import socket as socketlib
import resource
import subprocess import subprocess
import stat import stat
import sys import sys
...@@ -175,7 +176,10 @@ def launchSupervisord(instance_root, logger, ...@@ -175,7 +176,10 @@ def launchSupervisord(instance_root, logger,
supervisord_argument_list = ['-c', configuration_file] supervisord_argument_list = ['-c', configuration_file]
if supervisord_additional_argument_list is not None: if supervisord_additional_argument_list is not None:
supervisord_argument_list.extend(supervisord_additional_argument_list) 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.") logger.info("Launching supervisord with clean environment.")
# Extract python binary to prevent shebang size limit # Extract python binary to prevent shebang size limit
invocation_list = [sys.executable, '-c'] invocation_list = [sys.executable, '-c']
...@@ -188,7 +192,8 @@ def launchSupervisord(instance_root, logger, ...@@ -188,7 +192,8 @@ def launchSupervisord(instance_root, logger,
env={}, env={},
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
logger=logger) logger=logger,
preexec_fn=preexec_fn)
result = supervisord_popen.communicate()[0] result = supervisord_popen.communicate()[0]
if supervisord_popen.returncode: 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