Skip to content

rlimit infinity #1824

@matthieumarrast

Description

@matthieumarrast

Problem

In plugin's config.ini file we have:

# resource limit for each app worker
# rlimit_as => maximum area (in bytes) of address space which may be taken
#              by the worker.
# rlimit_nofile => maximum number of open file descriptors for the current
#                  worker.
# rlimit_stack => maximum size (in bytes) of the call stack for the current
#                 worker. This only affects the stack of the main thread
#                 in a multi-threaded worker.
# rlimit_fsize =>  maximum size of a file which the worker may create.
#   (empty value means no limit)
rlimit_as = 1000000000
rlimit_nofile = 1000
rlimit_stack = 10000000
rlimit_fsize = 100000000

So it results to the below circus configuration in tghe circus conf gile (~/tmp/config_auto/circus.ini`):

[watcher:app.<plugin>.main]
...
rlimit_as = 1000000000
rlimit_nofile = 1000
rlimit_stack = 10000000
rlimit_fsize = 100000000

But if we want to disable the limits by seizing empty values in the plugin's config.ini (as written in the comment)

#   (empty value means no limit)
rlimit_as = 
rlimit_nofile =  
rlimit_stack = 
rlimit_fsize = 

it results to missing rlimit options in ~/tmp/config_auto/circus.ini !!

In its documentation, circus indicates that To set a limit value to RLIM_INFINITY, do not set a value, like this config line: ‘rlimit_nofile = ‘.

IMPORTANT: this is applied in https://github.com/metwork-framework/circus/blob/master/circus/process.py, preexec function, check here if indeed infinity rlimits are not taken into accounts

Solution

We should have:

rlimit_as = 
rlimit_nofile =  
rlimit_stack = 
rlimit_fsize = 

in the circus.ini config file.

Update

{% if APP.rlimit_as > 0 %}rlimit_as = {{APP.rlimit_as}}{% endif %}
{% if APP.rlimit_nofile > 0 %}rlimit_nofile = {{APP.rlimit_nofile}}{% endif %}
{% if APP.rlimit_stack > 0 %}rlimit_stack = {{APP.rlimit_stack}}{% endif %}
{% if APP.rlimit_fsize > 0 %}rlimit_fsize = {{APP.rlimit_fsize}}{% endif %}

in file https://github.com/metwork-framework/mfext/blob/master/adm/templates/circus.ini

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions