[asterisk-bugs] [JIRA] (ASTERISK-24011) [patch]safe_asterisk tries to set ulimit -n too high on linux systems with lots of RAM

Matt Jordan (JIRA) noreply at issues.asterisk.org
Mon Nov 3 13:56:36 CST 2014


     [ https://issues.asterisk.org/jira/browse/ASTERISK-24011?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Jordan updated ASTERISK-24011:
-----------------------------------

    Target Release Version/s: 1.8.32.0

> [patch]safe_asterisk tries to set ulimit -n too high on linux systems with lots of RAM
> --------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-24011
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24011
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Contrib/General
>         Environment: 
>            Reporter: Michael Myles
>            Severity: Minor
>      Target Release: 1.8.32.0, 11.14.0, 13.0.0-beta3
>
>         Attachments: safe_asterisk-ulimit.diff
>
>
> It appears the safe_asterisk script tries to increase the open file limit based on the value in /proc/sys/fs/file-max divided by 2.  In some modern linux systems this value is calculated based on the amount of RAM available and turns out to be roughly 100 per 1MB of RAM. 
> see: fs/file_table.c in linux kernel
>     /*
>      * One file with associated inode and dcache is very roughly 1K.
>      * Per default don't use more than 10% of our memory for files. 
>      */ 
>     n = (mempages * (PAGE_SIZE / 1024)) / 10;
>     files_stat.max_files = max_t(unsigned long, n, NR_FILE);
> On systems with lots of RAM, (In our case a CentOS 6.4 server with 24GB of RAM) this number / 2 can exceed the upper limit which can actually be set per process (2^20=1048576)
> This causes the safe_asterisk script to fail to increase the max number of open files and ulimit to display the error: "open files: cannot modify limit: Operation not permitted"
> Suggest adding an upper bound check to the script to ensure that the value/2 is not above the maximum.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list