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

Rusty Newton (JIRA) noreply at issues.asterisk.org
Fri Aug 1 16:45:58 CDT 2014


Rusty Newton created ASTERISK-24153:
---------------------------------------

             Summary: [patch]safe_asterisk tries to set ulimit -n too high on linux systems with lots of RAM
                 Key: ASTERISK-24153
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24153
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Contrib/General
         Environment: 

            Reporter: Michael Myles
            Assignee: Rusty Newton
            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