Summary:ASTERISK-07301: [patch][post 1.4] add max_open_files=xxx to asterisk.conf
Reporter:Roy Sigurd Karlsbakk (rkarlsba)Labels:
Date Opened:2006-07-07 08:18:23Date Closed:2006-11-22 11:41:51.000-0600
Versions:Frequency of
Environment:Attachments:( 0) max_open_files.patch
Description:This patch allows for setting max open files (setrlimit/ulimit -n) in asterisk.conf. Since the default value for this on linux/bash is 1024, this is far too low for large systems.

I am aware of that posting patches for new features for 1.2 is disregarded, but after posting this on the -dev list, I was told by Olle to post it here anyway. The reason I don't have a patch for trunk, is just that I don't know my way around the new code too well.



example asterisk.conof

Comments:By: Clod Patry (junky) 2006-08-08 22:09:48

i dont see how this is relative to asterisk.
since you can do it via ulimit directly, no?

By: Roy Sigurd Karlsbakk (rkarlsba) 2006-08-09 08:33:08

The same way as setting -c unlimited, yes, but it's far more convenient to just set it in a config file, just like it's more convenient to start asterisk -g than bugging with ulimit.

Also, this is a simple patch, and it doesn't add complexity, and I find it a nice feature.

By: Clod Patry (junky) 2006-08-09 11:22:54

i perfectly understand this, but imagine this scenario:
you set ur config file to the value foo (probably unlimited), and another person on the system, change the ulimit, directly from the shell, to value bar, you will be like: what's wrong.

My feel is we should leave it with ulimit command.
Any way, this is a command you should just change once.

By: Serge Vecher (serge-v) 2006-08-09 11:24:23

I've also tried to find the discussion on asterisk-dev list but couldn't locate it quickly. Please provide the link.

By: Nir Simionovich (atelis) 2006-08-09 12:39:55

I believe that this issue is important, as I'm currently handling 2 systems that handle around 500 concurrent SIP channels at any given time, and the open_files issue arises after a while.
A workaround was to issue a ulimit command within the safe_asterisk script, but that is a very ugly fix - I believe a proper configuration value is surely in place for this.

By: Serge Vecher (serge-v) 2006-09-18 11:04:17

we still need to see a reference to the asterisk-dev list discussion, where the consensus prompted the code change.

By: Roy Sigurd Karlsbakk (rkarlsba) 2006-09-18 13:20:36

I looked through my -dev box, but couldn't find that.
Can't you just allow it in? it's pretty clean.
The only bad thing I've seen is that it seems to be run when you do an asterisk -r


By: jmls (jmls) 2006-11-01 05:47:49.000-0600

is this still needed as 7524 has been committed ?

By: Roy Sigurd Karlsbakk (rkarlsba) 2006-11-01 07:14:26.000-0600

I really don't think so, but then, ASTERISK-7329 lacks documentation so I really don't know what it does and how it does it.

By: Anthony LaMantia (alamantia) 2006-11-01 15:45:28.000-0600

the patch in 7524 allows access to a ulimit cli command but not anything configurable via asterisk.conf i am not sure that the cli command route meets the same need that this patch tries to remedy... thoughts?

By: jmls (jmls) 2006-11-01 16:04:08.000-0600

I would include this patch

By: Roy Sigurd Karlsbakk (rkarlsba) 2006-11-02 05:25:29.000-0600

Firstly, please setup a relationship between the two bugs. Maybe ASTERISK-7329 could be extended to allow configurable presets? That would be a lot neater than this patch

By: Anthony LaMantia (alamantia) 2006-11-02 10:41:55.000-0600

rkarlsba,  yes.. using res_limit.c rather then just appending the same code to asterisk.c seems like a good idea.

i think we should add a function to res_limit.c which would allow us to call setrlimit/getrlimit..etc   and then call that from asterisk.c durring processing of the config file..

rather then just adding more code to asterisk.c

By: Anthony LaMantia (alamantia) 2006-11-02 12:33:05.000-0600

i have made a patch that allows this using the method rkarlsba used at first.
you can view it here.

any thoughts on this rkarlsba?

By: Roy Sigurd Karlsbakk (rkarlsba) 2006-11-03 03:45:23.000-0600

Looks fine to me


By: Serge Vecher (serge-v) 2006-11-09 09:31:31.000-0600

By: Anthony LaMantia (alamantia) 2006-11-09 16:12:55.000-0600

I am going to go-ahead and add some documentation changes inside of it, so if we want to go ahead with this in trunk. we can.

By: Anthony LaMantia (alamantia) 2006-11-17 15:44:20.000-0600

this patch is seems ok to commit.

By: Ronald Chan (loloski) 2006-11-19 21:45:00.000-0600


Is this ready for commit? or it needs to think even more? IMHO this is great :)

By: wlloyd (wlloyd) 2006-11-20 23:24:23.000-0600

I was just trying to solve this issue and came upon this.

In some settings like Slackware that I'm running, setting ulimit to whatever value you want for daemons at boot time is non obvious.  Yes I can run ulmit -n xxxx first, everytime I run asterisk.

In a high volume enviroment I'm running into the same issue.  I think this is a great way to solve this so that the daemon can just be run from the command line.

By: Anthony LaMantia (alamantia) 2006-11-21 12:08:14.000-0600

it's ready to commit. the one problem is documentation there is no real sample config for this file that i can easily add documentation to(at least one that i see for asterisk.conf) maybe we should just make one and include it in with this patch..  other then that the patch is solid.

By: Anthony LaMantia (alamantia) 2006-11-21 16:17:05.000-0600

assigned to file for commital review.

By: Joshua C. Colp (jcolp) 2006-11-22 11:41:49.000-0600

Put into trunk as of revision 47933. file said let there be a maxfiles option!