[asterisk-dev] Asterisk and file descriptors

Daniel Ferrer daniel at ipcontact.com.uy
Thu Oct 16 08:01:46 CDT 2008


Yes, as Steve says running !ulimig -n from CLI return's 1024, ulimit of 
root user, because asterisk is running as user "asterisk".
I've made a simple modification to asterisk.c:handle_version, to print 
out the value of this limit (added this lines at the end):

  struct rlimit rlim;
   if (!getrlimit(RLIMIT_NOFILE, &rlim))
     ast_cli(fd, "  Current fd limits:           current: %i max: %i\n", 
rlim.rlim_cur, rlim.rlim_max);

This give me:
    Current fd limits:           current: 65535 max: 0

(because I put "ulimit -n 65535" in run_asterisk in /usr/sbin/safe_asterisk)

So I'm sure that ulimit -n is correctly setted up. Now getting back to 
bug, I moved "cache_record_files" dir to an ext3 partition (before it 
was using an XFS one). Messages like "format_wav.c: Unable to find our 
position" dissapeared, but I've a lot of "audiohook.c: Failed to get 160 
samples from write factory".
Load rises above 50 sometimes and sometimes get normal. Sometimes I get 
no log at all!: there's 20 seconds without a line in log (verbose, 
debug, warning, notice, error), and sometimes I get only audiohook 
messages in log.

I don't know what to do. Should I compile with DEBUG_THREADS and see a 
core show locks?

Thanks in advance
bye
daniel


Steve Edwards escribió:
> On Wed, 15 Oct 2008, Terry Wilson wrote:
> 
>>> I tracked some time ago this issue, but seems that the amount of file
>>> descriptors is ok. If I do "ls -l /proc/PID/fd | wc -l" I get normally
>>> 400-500 fd's. Looking at safe_asterisk's code, when there is no ulimit
>>> -n, it configures max open files to half of value in
>>> /proc/sys/fs/file-max, which is 103152 in our case, so this doesn't
>>> seems an issue.
>>> Also seems that when this error is triggered, there's and audiohook
>>> message complaing of write/read factory:
>> I recommend running !ulimit -n from the asterisk CLI to see what the
>> setting really is.  I seem to remember that setting it in the
>> safe_asterisk script has no effect.
> 
> Isn't this going to show the maximum number of open file descriptors in 
> the command line process instead of the daemon?
> 
> Thanks in advance,
> ------------------------------------------------------------------------
> Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
> Newline                                             Fax: +1-760-731-3000
> 
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
> 
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev


-- 
Ing. Daniel Ferrer
IPContact Software S.R.L.
(+5982) 4025420




More information about the asterisk-dev mailing list