Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stuck in high CPU usage mod_lua #2601

Open
jchavanton opened this issue Sep 18, 2024 · 0 comments
Open

stuck in high CPU usage mod_lua #2601

jchavanton opened this issue Sep 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jchavanton
Copy link
Contributor

jchavanton commented Sep 18, 2024

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;
      }
    }
@jchavanton jchavanton added the bug Something isn't working label Sep 18, 2024
@jchavanton jchavanton changed the title stuck in high CPU usage (draft) stuck in high CPU usage mod_lua Sep 18, 2024
jchavanton added a commit to jchavanton/freeswitch that referenced this issue Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant