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

Matt Jordan (JIRA) noreply at issues.asterisk.org
Thu Jul 10 09:16:56 CDT 2014


    [ https://issues.asterisk.org/jira/browse/ASTERISK-24011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=220430#comment-220430 ] 

Matt Jordan commented on ASTERISK-24011:
----------------------------------------

If you'd like to contribute a patch that would check for said upper limit, that would be appreciated.

> 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
>         Environment: 
>            Reporter: Michael Myles
>            Severity: Minor
>
> 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