Search code examples
asteriskasteriskami

Asterisk got hang CLI restart not work 12.8.1 on EC2 micro


I have FIAF with asterisk 12.8.1 running on Amazon EC2 instance. I have created 20 extensions. I have created a JAVA AMI connection which is having 3 thread. Each thread have connection to asterisk AMI with Event: system, command and OFF. Randomly asterisk got hang and did not take any command from CLI. Only option have at that time is - kill the asterisk service and restart it. After that everything works fine.

CentOS release 6.7 (Final)
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch

I have attached the gdb when asterisk was hang by attaching process id and taken BT and BT FULL.

(gdb) bt full
#0  0x000000340d6df113 in poll () from /lib64/libc.so.6
No symbol table info available.
#1  0x000000000044eb7d in ast_el_read_char (editline=<value optimized out>, cp=0x7ffc71cdae0f "") at asterisk.c:2657
        num_read = 0
        lastpos = 0
        fds = {{fd = -1, events = 1, revents = 0}, {fd = 0, events = 1, revents = 0}}
        res = <value optimized out>
        max = <value optimized out>
        buf = " \255\315q\374\177\000\000H\255\315q\374\177\000\000\000`\357\023\231\177\000\000\000\000\000\000\000\000\000\000\364\226\317\033\000\000\000\000\n\237 \r4", '\000' <repeats 19 times>, "\005", '\000' <repeats 15 times>, "\001\000\000\000\000\000\000\000\000`\357\023\231\177\000\000\005\000\000\000\064", '\000' <repeats 11 times>, "\001\000\000\000\000\000\000\000\000`\357\023\231\177\000\000\000\000\000\000\000\000\000\000Xc\357\023\231\177\000\000Ь\315q\374\177\000\000\005\000\000\000\000\000\000\000\350\254\315q\374\177\000\000Xc\357\023\001\000\000\000\360\254\315q\374\177\000\000{=\240\017\064\000\000\000\b\255\315q\374\177\000\000\240\347\230\r\001\000\000\000\240\347\230\r4\000\000\000{9\240\017\064\000\000\000\001\000\000\000\000\000\000\000\247\347f\r4\000\000\000`\236\230\000\000\000\000\000}U\241\017\064\000\000\000`\236\230\000\000\000\000\000"...
        __PRETTY_FUNCTION__ = "ast_el_read_char"
#2  0x000000340fa1146b in el_gets () from /usr/lib64/libedit.so.0
No symbol table info available.
#3  0x000000000045199c in main (argc=<value optimized out>, argv=<value optimized out>) at asterisk.c:4603
        title = "Asterisk Console on 'ip-172-31-51-113' (pid 9881)", '\000' <repeats 71 times>"\340, \024B\r4\000\000\000\000\300\315q\374\177\000\000\066\223 \r4\000\000\000\030\300\315q\374\177\000\000\060\300\315q\001\000\000\000\273\225\223\034\000\000\000\000P\222A\000\000\000\000\000\034\000\000\000\000\000\000\000\200\070\357\023\231\177\000\000.N=\366\000\000\000\000Фg\r4\000\000\000\tC\351\034\000\000\000\000\070\365\330\003\000\000\000\000.\000\000\000\000\000\000\000T:`\r4\000\000\000\000\000\000\000\005\000\000\000\001\000\000\000\000\000\000"
        c = <value optimized out>
        filename = "/root/.asterisk_history", '\000' <repeats 56 times>
        hostname = "ip-172-31-51-113", '\000' <repeats 47 times>
        xarg = 0x0
        x = <value optimized out>
        f = <value optimized out>
        sigs = {__val = {134238211, 0 <repeats 15 times>}}
        num = 0
        isroot = 1
        rundir_exists = <value optimized out>
        buf = <value optimized out>
        runuser = 0x7ffc71cdae90 "asterisk"
        rungroup = 0x7ffc71cdae70 "asterisk"
        remotesock = <value optimized out>
        moduleresult = <value optimized out>
        l = {rlim_cur = 49317, rlim_max = 49317}
        __func__ = "main"
        __PRETTY_FUNCTION__ = "main"
(gdb)

I will appreciate if any body can suggest the reason or propose the work around for the same.


Solution

  • You have compile it with build_native=no

    For change it, do

    make menuconfig 
    

    before make command.

    Please note, asterisk anyway will not work ok on micro instance due to not enought realtime cpu availible.

    Also for non-expert it is recommended use already created AMI.