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

Michael Myles (JIRA) noreply at issues.asterisk.org
Thu Jul 10 10:02:56 CDT 2014


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

Michael Myles updated ASTERISK-24011:
-------------------------------------

    Attachment: safe_asterisk-ulimit.diff

Attaching patch.
This just caps MAXFILES at 2^20 which is probably still far higher than would ever be necessary or sane, but should at least prevent safe_asterisk from exceeding the absolute maximum in most implementations.

> 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
>         Attachments: safe_asterisk-ulimit.diff, 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