1

I ran in to this and I found only one other post on this is had the fix but it wasn't that clear and a couple years old.

Ubuntu 20.04 Asterisk 16.9

Error Message:

[Jul 20 21:37:16] WARNING[1742] alertpipe.c: Failed to create alert pipe with eventfd(), falling back to pipe(): Too many open files
[Jul 20 21:37:16] WARNING[1742] alertpipe.c: Failed to create alert pipe: Too many open files

Asterisk PID: 1130

Check the limits for the process. Max open file soft limit is 1024

root@trueringless-asterisk:/home/esundberg# cat /proc/1130/limits 
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             64057                64057                processes 
Max open files            1024                 4096                 files
Max locked memory         16777216             16777216             bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       64057                64057                signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us        

edit /etc/asterisk/asterisk.conf

[options]
maxfiles = 4096                 ; Maximum amount of openfiles.

Stop the asterisk process

# systemctl stop asterisk

Make sure asterisk is stopped

# ps -ef | grep asterisk

Start the asterisk process

# systemctl start asterisk

Get the New asterisk PID

# ps -ef | grep asterisk
root      4925*     1 16 05:07 ?        00:00:00 /usr/sbin/asterisk

Check the file limits they are now at 4096 for the process

# cat /proc/4925/limits 
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             64057                64057                processes 
Max open files            4096                 4096                 files     
Max locked memory         16777216             16777216             bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       64057                64057                signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us        

1 Answers1

1

The simplest solution is just to rewrite systemd or init.d script you are using for start asterisk or /usr/sbin/safe_asterisk.sh script.

arheops
  • 14,948
  • 1
  • 17
  • 28