# 100% CPU usage for asterisk

**URL:** <https://community.asterisk.org/t/100-cpu-usage-for-asterisk/45908>\
**Category:** Asterisk Support\
**Created:** [April 16, 2014, 11:03am UTC](https://community.asterisk.org/t/100-cpu-usage-for-asterisk/45908 "2014-04-16T11:03:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![preeti1207](https://avatars.discourse-cdn.com/v4/letter/p/a5b964/32.png) [@preeti1207](https://community.asterisk.org/u/preeti1207)\
**Post date:** [April 16, 2014, 11:03am UTC](https://community.asterisk.org/t/100-cpu-usage-for-asterisk/45908/1 "2014-04-16T11:03:34Z")

</div>

Dear All,  
We are using asterisk-1.8,5.0 on our CentOS machine. Everytime our asterisk crashed because of 100% CPU usage. We did lot of analysis, but enable to track the issue.  
We run this command "# ps -LlFm -p `pidof asterisk`" to check 100%CPU usage of each asterisk thread and below is the output:  
F S UID PID PPID LWP C NLWP PRI NI ADDR SZ WCHAN RSS PSR STIME TTY TIME CMD  
4 - root 29661 29659 - 0 43 - - - 863265 - 27168 - 09:43 pts/1 00:00:01 /usr/sbin/asterisk -f -vvvg -c  
4 S root - - 29661 0 - 80 0 - - n\_tty\_ - 5 09:43 - 00:00:00 -  
1 S root - - 29662 0 - 80 0 - - inotif - 4 09:43 - 00:00:00 -  
1 S root - - 29663 0 - 80 0 - - futex\_ - 0 09:43 - 00:00:00 -  
1 S root - - 29664 0 - 80 0 - - poll\_s - 0 09:43 - 00:00:00 -  
1 S root - - 29665 0 - 80 0 - - futex\_ - 5 09:43 - 00:00:00 -  
1 S root - - 29666 0 - 80 0 - - futex\_ - 5 09:43 - 00:00:00 -  
1 S root - - 29667 0 - 80 0 - - futex\_ - 2 09:43 - 00:00:00 -  
1 S root - - 29668 0 - 80 0 - - poll\_s - 4 09:43 - 00:00:00 -  
1 S root - - 29669 0 - 80 0 - - futex\_ - 7 09:43 - 00:00:00 -  
1 S root - - 29670 0 - 80 0 - - futex\_ - 4 09:43 - 00:00:00 -  
1 S root - - 29671 0 - 80 0 - - futex\_ - 5 09:43 - 00:00:00 -  
1 S root - - 29672 0 - 80 0 - - futex\_ - 5 09:43 - 00:00:00 -  
1 S root - - 29673 0 - 80 0 - - futex\_ - 4 09:43 - 00:00:00 -  
1 S root - - 29674 0 - 80 0 - - futex\_ - 5 09:43 - 00:00:00 -  
1 S root - - 29675 0 - 80 0 - - futex\_ - 5 09:43 - 00:00:00 -  
1 S root - - 29676 0 - 80 0 - - futex\_ - 5 09:43 - 00:00:00 -  
1 S root - - 29677 0 - 80 0 - - futex\_ - 6 09:43 - 00:00:00 -  
1 S root - - 29678 0 - 80 0 - - futex\_ - 5 09:43 - 00:00:00 -  
1 S root - - 29679 0 - 80 0 - - futex\_ - 6 09:43 - 00:00:00 -  
1 S root - - 29680 0 - 80 0 - - futex\_ - 7 09:43 - 00:00:00 -  
1 S root - - 29681 0 - 80 0 - - futex\_ - 5 09:43 - 00:00:00 -  
1 S root - - 29682 0 - 80 0 - - futex\_ - 6 09:43 - 00:00:00 -  
1 S root - - 29683 0 - 80 0 - - futex\_ - 5 09:43 - 00:00:00 -  
1 S root - - 29684 0 - 80 0 - - futex\_ - 6 09:43 - 00:00:00 -  
1 S root - - 29685 0 - 80 0 - - futex\_ - 5 09:43 - 00:00:00 -  
1 S root - - 29686 0 - 80 0 - - poll\_s - 5 09:43 - 00:00:00 -  
1 S root - - 29687 0 - 80 0 - - poll\_s - 5 09:43 - 00:00:00 -  
1 S root - - 29688 0 - 80 0 - - poll\_s - 0 09:43 - 00:00:00 -  
1 S root - - 29689 0 - 80 0 - - poll\_s - 1 09:43 - 00:00:00 -  
1 S root - - 29690 0 - 80 0 - - poll\_s - 0 09:43 - 00:00:00 -  
1 S root - - 29691 0 - 80 0 - - inet\_c - 5 09:43 - 00:00:00 -  
1 S root - - 29692 0 - 80 0 - - poll\_s - 0 09:43 - 00:00:00 -  
1 S root - - 29693 0 - 80 0 - - poll\_s - 2 09:43 - 00:00:00 -  
1 S root - - 29694 0 - 80 0 - - hrtime - 2 09:43 - 00:00:00 -  
1 S root - - 29695 0 - 80 0 - - hrtime - 5 09:43 - 00:00:00 -  
1 S root - - 29696 0 - 80 0 - - futex\_ - 5 09:43 - 00:00:00 -  
1 S root - - 29697 0 - 80 0 - - hrtime - 5 09:43 - 00:00:00 -  
1 S root - - 29698 0 - 80 0 - - poll\_s - 5 09:43 - 00:00:00 -  
1 S root - - 29699 0 - 80 0 - - hrtime - 5 09:43 - 00:00:00 -  
1 S root - - 29700 0 - 80 0 - - poll\_s - 5 09:43 - 00:00:00 -  
1 S root - - 29701 0 - 80 0 - - poll\_s - 6 09:43 - 00:00:00 -  
1 S root - - 29702 0 - 80 0 - - futex\_ - 6 09:43 - 00:00:00 -  
1 S root - - 29703 0 - 80 0 - - poll\_s - 5 09:43 - 00:00:00 -  
1 R root - - 27363 21 - 80 0 - - - - 1 07:51 - 00:18:53

After that, we run command “# pstack `pidof asterisk` \> /tmp/asterisk.stack.txt” to check the stack state of process and here is the output:  
Thread 21 (Thread 0x7f2fface5700 (LWP 27363)):  
#0 0x00000038398cf527 in sched\_yield () from /lib64/libc.so.6  
#1 0x00007f30142c6b56 in \_\_sip\_autodestruct () from /usr/lib/asterisk/modules/chan\_sip.so  
#2 0x00000000005207f6 in ast\_sched\_runq ()  
#3 0x00007f30142e7ee7 in do\_monitor () from /usr/lib/asterisk/modules/chan\_sip.so  
#4 0x0000000000536f2a in dummy\_start ()  
#5 0x0000003839c079d1 in start\_thread () from /lib64/libpthread.so.0  
#6 0x00000038398e8b6d in clone () from /lib64/libc.so.6  
I didn’t understand where exactly the problem is.  
I also read in google that 100% could be result of corrupt database astdb file.  
Can anybody help in resolving this issue.That would be great help.Thanks.
