freeswitch
                                
                                 freeswitch copied to clipboard
                                
                                    freeswitch copied to clipboard
                            
                            
                            
                        stuck in high CPU usage mod_lua
Describe the bug Once in a while, running FS instances can get stuck in high CPU usage.
To Reproduce Intermittent, not clear.
Expected behavior A few threads are starting to use 100% CPU
Package version or git hash
- Version [master]
GDB attach
top -H -p 1
    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                             
      1 root      -2 -10 4461968 465116  40592 S  99.9   2.9     3w+0d freeswitch                                                                                                                          
    181 root      -2 -10 4461968 465116  40592 R  98.0   2.9    6d+19h freeswitch                                                                                                                          
    182 root      -2 -10 4461968 465116  40592 R  95.0   2.9    6d+18h freeswitch                                                                                                                          
   1612 root      -2 -10 4461968 465116  40592 R  95.0   2.9    6d+16h freeswitch                                                                                                                          
gdb /usr/local/freeswitch/bin/freeswitch 1
(gdb) symbol-file /usr/local/freeswitch/bin/freeswitch
(gdb) info threads
  39   Thread 0x7f941f4586c0 (LWP 181) "freeswitch"  SWIG_PropagateClientData () at mod_lua_wrap.cpp:10711
  40   Thread 0x7f941f41b6c0 (LWP 182) "freeswitch"  0x00007f941fd3fb9d in SWIG_PropagateClientData () at mod_lua_wrap.cpp:10711
  41   Thread 0x7f941d1146c0 (LWP 1612) "freeswitch" 0x00007f949c8f315f in __GI___poll (fds=fds@entry=0x7f941d10a800, nfds=1, timeout=timeout@entry=20) at ../sysdeps/unix/sysv/linux/poll.c:29
Related Commit
commit 830a8493deff2bc2571023fad899c31fd2edab32
Author: Anthony Minessale <[email protected]>
Date:   Mon Jun 2 23:37:12 2008 +0000
    add answered and mediaReady methods to CoreSession
    
    git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8743 d0543943-73ff-0310-b7d9-9358b9ac24b2
I can see the endless loop
(gdb) p *equiv
$2 = {type = 0x7f941fd4da20, converter = 0x0, next = 0x7f941fd4d120, prev = 0x7f941fd4d120}
  for (i = 0; i < swig_module.size; i++) {
    if (swig_module.types[i]->clientdata) {
      equiv = swig_module.types[i]->cast;
      while (equiv) {
        if (!equiv->converter) {
          if (equiv->type && !equiv->type->clientdata)                                                                                                                                                     
            SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
        }
        equiv = equiv->next;
      }
    }
Patch to be tested
  for (i = 0; i < swig_module.size; i++) {
    if (swig_module.types[i]->clientdata) {
      equiv = swig_module.types[i]->cast;
      while (equiv) {
        if (!equiv->converter) {
          if (equiv->type && !equiv->type->clientdata)                                                                                                                                                     
            SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
        }
        if (equiv == equiv->next) {
            break;
        }
        equiv = equiv->next;
      }
    }