Commit 02720186 authored by Levin Zimmermann's avatar Levin Zimmermann

software/erp5: Add nofile option

erp5@d8b5b910 added the functionality to ERP5 to
set its soft limit of allowed open file descriptors to the system wide hard limit.
This parameter is useful for Wendelin based instances where the 1024
limit is easily reached.

With this patch, this parameter can also be set via SlapOS, which
simplifies usage of the Wendelin SR.
parent 2921d965
......@@ -103,6 +103,11 @@
"null"
]
},
"nofile": {
"description": "Set open file descriptors soft limit to hard limit",
"default": false,
"type": "boolean"
},
"family-override": {
"description": "Family-wide options, possibly overriding global options",
"default": {},
......
......@@ -32,6 +32,7 @@ import glob
import http.client
import json
import os
import resource
import shutil
import socket
import sqlite3
......@@ -1100,3 +1101,24 @@ class TestNEO(ZopeSkinsMixin, CrontabMixin, ERP5InstanceTestCase):
'var',
'log',
f))
class TestNofileParameter(ERP5InstanceTestCase, TestPublishedURLIsReachableMixin):
"""Test setting the nofile parameter sets the open fd soft limit to the hard limit.
"""
__partition_reference__ = 'nofile'
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'nofile': True})}
def test_nofile(self):
with self.slap.instance_supervisor_rpc as supervisor:
all_process_info = supervisor.getAllProcessInfo()
_, current_hard_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
for p in all_process_info:
if not p['name'].startswith('zope-'):
continue
self.assertEqual(
resource.prlimit(p['pid'], resource.RLIMIT_NOFILE),
(current_hard_limit, current_hard_limit))
......@@ -74,7 +74,7 @@ md5sum = 3f7b28085ceff321a3cb785db60f7c3e
[template-erp5]
filename = instance-erp5.cfg.in
md5sum = 098e1d02159aeca9b36f2a0726b7b230
md5sum = 44eb65180b0ffa6262dcec8399870862
[template-zeo]
filename = instance-zeo.cfg.in
......@@ -86,7 +86,7 @@ md5sum = 0ac4b74436f554cd677f19275d18d880
[template-zope]
filename = instance-zope.cfg.in
md5sum = e6c94c2a48788683bf0d63d135a44932
md5sum = 5abcceeb88a90941d141c2a84d4228fb
[template-balancer]
filename = instance-balancer.cfg.in
......
{% import "root_common" as root_common with context -%}
{% import "caucase" as caucase with context %}
{% set frontend_dict = slapparameter_dict.get('frontend', {}) -%}
{% set has_frontend = frontend_dict.get('software-url', '') != '' -%}
......@@ -311,6 +312,7 @@ config-longrequest-logger-interval = {{ dumps(zope_parameter_dict.get('longreque
config-longrequest-logger-timeout = {{ dumps(zope_parameter_dict.get('longrequest-logger-timeout', 1)) }}
config-large-file-threshold = {{ dumps(zope_parameter_dict.get('large-file-threshold', "10MB")) }}
config-port-base = {{ dumps(zope_parameter_dict.get('port-base', 2200)) }}
config-nofile = {{ dumps(slapparameter_dict.get('nofile', false)) }}
{# BBB: zope_parameter_dict used to contain 'webdav', so fallback to it -#}
config-webdav = {{ dumps(current_zope_family_override_dict.get('webdav', zope_parameter_dict.get('webdav', False))) }}
config-publisher-timeout = {{ dumps(current_zope_family_override_dict.get('publisher-timeout', global_publisher_timeout)) }}
......
{% from "instance_zodb_base" import zodb_dict with context %}
{% set webdav = slapparameter_dict['webdav'] -%}
{% set nofile = slapparameter_dict['nofile'] -%}
{% set thread_amount = slapparameter_dict['thread-amount'] %}
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
{% set ports = itertools.count(slapparameter_dict['port-base']) -%}
......@@ -345,6 +346,7 @@ wrapped-command-line =
--access-log-file={{ '${' ~ conf_parameter_name ~ ':z2-log}' }}
{% if longrequest_logger_interval > 0 %} --long-request-log-file={{ '${' ~ conf_parameter_name ~ ':longrequest-logger-file}' }} {% endif %}
{% if webdav %}-w{% endif %}
{% if nofile %}--nofile{% endif %}
{{ ipv4 }}:${:port}
{% if timerserver_interval %}--timerserver-interval={{ timerserver_interval }}{% endif %}
'${:configuration-file}'
......
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