Our asterisk server freezes 2 time in the last month with theses errors in the log:
[Jun 22 13:34:29] ERROR[6637] rtp.c: Unable to allocate socket: Too many open files
[Jun 22 13:34:29] WARNING[6637] udptl.c: Unable to allocate socket: Too many open files
[Jun 22 13:34:29] WARNING[6637] chan_sip.c: Unable to create RTP audio session: Too many open files
[Jun 22 13:34:29] ERROR[6637] chan_sip.c: Unable to build sip pvt data for '230' (Out of memory or socket error)
[Jun 22 13:34:29] WARNING[6637] app_dial.c: Unable to create channel of type 'Sip' (cause 42 - Switching equipment congestion)
Result of my ulimit -a :
[root@leia ~]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
max nice (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 16250
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
max rt priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 16250
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
I just put the max number of open files to 3000 (ulimit -n 3000). But i don’t understand why my asterisk box would need so many open files !
I don’t have a lot of services running on this box (asterisk,hylafax,mysql,httpd). I must be doing something wrong. Any idea?
Well that would be very suprising since the only access to or from the WAN is by the IAX port. But I will look into it. Any know security issue with IAX2 that could cause my problem ?
Hi, this exact problem is an issue with Asterisk versions upto 1.4.4. It has now been fixed in 1.4.5 Please upgrade. we had this same issue, an upgrading resolved it.
Sorry to bring this post up again.
I updated my system (1.4.10.1) and i tought it solved the bug because the system din’t crash since then.
But today the system crashed and after a look at my logs I got undreads of them :
[code]
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[Sep 21 16:22:14] NOTICE[18000] manager.c: Accept returned -1: Too many open files
[root@leia /]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
max nice (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 16250
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
max rt priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 16250
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
You must run ulimit to increase the number of available files USING THE SAME INSTANCE that will run asterisk. In other words, running it in the current linux console won’t help. If you run it in the current console, you must restart asterisk. However, when you reboot you server, you will be right where you started.
You should put the ulimit command within the /etc/rcX.d structure and have it execute when the server is booting AND before asterisk executes.