[Home]

Summary:ASTERISK-26077: safe_asterisk ulimit can be above kernel max
Reporter:rsw686 (rsw686)Labels:
Date Opened:2016-05-31 11:05:02Date Closed:
Priority:MajorRegression?
Status:Open/NewComponents:Contrib/General
Versions:Frequency of
Occurrence
Related
Issues:
is related toASTERISK-24011 [patch]safe_asterisk tries to set ulimit -n too high on linux systems with lots of RAM
Environment:Attachments:
Description:safe_asterisk calculates the ulimit based on file-max divided by two. On certain systems this value can be above the kernel max, which results in the open file limit not being applied. Some research shows the kernel max is 1024 * 1024 and I am able to successfully execute ulimit -n 1048576.

cat /proc/sys/fs/file-max
2466684

2466684 / 2 = 1233342

ulimit -n 1233342
-bash: ulimit: open files: cannot modify limit: Operation not permitted
Comments:By: Asterisk Team (asteriskteam) 2016-05-31 11:05:03.097-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: rsw686 (rsw686) 2016-05-31 12:46:35.120-0500

To provide some documentation please see the below exerts from https://www.kernel.org/doc/Documentation/sysctl/fs.txt. Based on this safe_asterisk should be modified to check if /proc/sys/fs/file-max / 2 is larger than /proc/sys/fs/nr_open. If it is than nr_open should be used instead to set the ulimit.

file-max & file-nr:
The value in file-max denotes the maximum number of file-
handles that the Linux kernel will allocate. When you get lots
of error messages about running out of file handles, you might
want to increase this limit.

nr_open:
This denotes the maximum number of file-handles a process can
allocate. Default value is 1024*1024 (1048576) which should be
enough for most machines.