[Asterisk-Users] Too many open files

Matt Roth mroth at imminc.com
Thu Apr 6 10:45:41 MST 2006


Raymond Chen wrote:

> Dear all,
>
> we have encounter problem when starting asterisk in the foreground,   
> "asterisk -vvvvgc"  with more 100 SIP calls concurrently.  we have set 
> ulimit to the highest value. still has this problem.  Is this the 
> problem keeping asterisk in the foreground or this is a bug in SVN 1.2 
> 16771?
>
>
> Apr  5 08:48:36 WARNING[14887]: channel.c:562 ast_channel_alloc: 
> Channel allocation failed: Can't create alert pipe!
> Apr  5 00:48:36 WARNING[14887]: chan_local.c:523 local_new: Unable to 
> allocate channel structure(s)
> Apr  5 08:48:36 NOTICE[14887]: app_dial.c:1042 dial_exec_full: Unable 
> to create channel of type 'LOCAL' (cause 0 - Unknown)
> Apr  5 08:48:36 WARNING[14893]: res_agi.c:246 launch_script: unable to 
> create fromast pipe: Too many open files
> Apr  5 08:48:37 WARNING[14894]: res_agi.c:246 launch_script: unable to 
> create fromast pipe: Too many open files
> Apr  5 08:48:38 WARNING[14897]: channel.c:562 ast_channel_alloc: 
> Channel allocation failed: Can't create alert pipe!
> Apr  5 00:48:38 WARNING[14897]: channel.c:562 ast_channel_alloc: 
> Channel allocation failed: Can't create alert pipe!
> Apr  5 00:48:38 WARNING[14897]: chan_local.c:523 local_new: Unable to 
> allocate channel structure(s)
> Apr  5 00:48:38 NOTICE[14897]: app_dial.c:1042 dial_exec_full: Unable 
> to create channel of type 'LOCAL' (cause 0 - Unknown)
> Apr  5 00:48:38 ERROR[14899]: rtp.c:933 ast_rtp_new_with_bindaddr: 
> Unable to allocate socket: Too many open files
> Apr  5 08:48:38 WARNING[14899]: chan_sip.c:3079 sip_alloc: Unable to 
> create RTP audio  session: Too many open files
>
> ulimit -a
>
> core file size          (blocks, -c) unlimited
> data seg size           (kbytes, -d) unlimited
> file size               (blocks, -f) unlimited
> pending signals                 (-i) 1024
> max locked memory       (kbytes, -l) 32
> max memory size         (kbytes, -m) unlimited
> open files                      (-n) 65535
> pipe size            (512 bytes, -p) 8
> POSIX message queues     (bytes, -q) 819200
> stack size              (kbytes, -s) 10240
> cpu time               (seconds, -t) unlimited
> max user processes              (-u) 16383
> virtual memory          (kbytes, -v) unlimited
> file locks                      (-x) unlimited
>
> thanks
>
> Ray

Ray,

How are you starting Asterisk?  We had the same problem when we were 
starting Asterisk from an init script.  The problem was that we were 
increasing the open file limit in "/etc/security/limits.conf".  From a 
system prompt ulimit was showing the increased open file limit, but 
here's the catch:

"limits.conf" is only applied to logins, so when Asterisk was run from 
an init script it was still bound to the default limit for open files: 
1024.  The solution was to add the command "ulimit -n 65536" to the init 
script, prior to starting Asterisk.

This was a tricky problem to debug, because once Asterisk bombed we 
would log in, stop the process, and restart it from the prompt.  The new 
instance inherited the settings from "limits.conf" and everything ran 
fine until the next reboot.

I hope this helps, but if it doesn't here is some more useful 
information.  "/proc/<pid_of_asterisk>/fd/" contains a list of 
Asterisk's open files.  "ls -l /proc/<pid_of_asterisk>/fd | wc -l" will 
give you a rough count of the number of files Asterisk has open at any 
given moment.  "lsof" will also list the open files on the system.  
Check out its man page for details.

Matthew Roth
InterMedia Marketing Solutions
Software Engineer and Systems Developer



More information about the asterisk-users mailing list