signalwire / freeswitch

FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device.
https://freeswitch.com/#getting-started
Other
3.61k stars 1.43k forks source link

FreeSwitch hangs and is not possible to connect #125

Open wmasilva opened 4 years ago

wmasilva commented 4 years ago

runnning fs current master fs just stop processing new calls, registration and when tried to connect..i couldn't.

This as been discuss in the mainling "FreeSwitch Hangs and Fails to Process anything", hope the new data helps to figure it out what is causing the issue.

In log the last messages where:

2019-11-13 10:51:58.671094 [ERR] sofia_reg.c:2471 trunk Failed Registration with status Service Unavailable [503]. failure #118
2019-11-13 10:51:59.671095 [WARNING] sofia_reg.c:510 trunk Failed Registration [503], setting retry to 30 seconds.
2019-11-13 10:52:00.271055 [WARNING] sofia_reg.c:1795 SIP auth challenge (REGISTER) on sofia profile 'backup' for [vpi59iif0a96a1@ar1.labvm.com] from ip 192.169.120.151
2019-11-13 10:52:00.371020 [WARNING] sofia_reg.c:1795 SIP auth challenge (INVITE) on sofia profile 'backup' for [bio@ar1.labvm.com] from ip 192.169.120.151
2019-11-13 10:52:00.431125 [INFO] mod_sms.c:368 Processing text message vpi59iif0a96a1->bio in context default
2019-11-13 10:52:00.431125 [INFO] switch_cpp.cpp:1443  /script/fs/message_bio.lua:14 received message from 'vpi59iif0a96a1@ar1.labvm.com' to 'bio@ar1.labvm.com'
2019-11-13 11:14:23.711095 [WARNING] sofia.c:2303 MSG Thread 2 Started
2019-11-13 11:14:23.711095 [WARNING] sofia.c:2303 MSG Thread 1 Started
5155f872-fa0c-443a-8fa3-daf449232c4e 2019-11-13 11:22:24.291095 [NOTICE] switch_channel.c:1118 New Channel sofia/backup/400@192.168.130.4 [5155f872-fa0c-443a-8fa3-daf449232c4e]
2019-11-13 11:22:42.131099 [INFO] mod_verto.c:1903 191.169.120.151:56938 Client sent close request

Freeswitch was runing:
root     21614  1.9  7.8 1666620 1290428 ?     S<Lsl 09:49   2:23 /usr/bin/freeswitch -ncwait -nonat -scripts /scripts/fs

I got a gcore from the pid file.
...
[New LWP 16925]
[New LWP 18162]
[New LWP 18216]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fc630a26037 in __GI___select (nfds=0, readfds=0x0, writefds=0x0, exceptfds=0x0, timeout=0x7ffdf1a52890) at ../sysdeps/unix/sysv/linux/select.c:41
41  ../sysdeps/unix/sysv/linux/select.c: No such file or directory.
warning: target file /proc/21614/cmdline contained unexpected null characters
Saved corefile core.21614
[Inferior 1 (process 21614) detached]

Attach full bt. gdb.txt

wmasilva commented 4 years ago

forget to add that this issue is not happening in fs v1.8 in debian jessie.

It happen to me now that i'm trying to update to FS v1.10, it happen on both old old debian jessie and debian buster (10).

jungle-boogie commented 4 years ago

Mailing list link: https://lists.freeswitch.org/pipermail/freeswitch-users/2019-November/132691.html

wmasilva commented 4 years ago

found what is causing the lock, i've a lua script to handle sip messages, to reply to the sender i use sofia_contact function, disable it and using the information received from the message prevents this issue from happening.

Is there a way to debug what is causing the lock in sofia_contact? or another way to avoid this? i want to use sofia_contact so i can initiate the chat from the server.

My function to send message:

        contact = api:execute("sofia_contact", destination);
    sip_profile = contact:match("sofia/(.*)/") or "";
    sip_to = contact:match("sofia/.*/(.*)") or "";
    if (sip_profile == "" or sip_to == "") then
        cm.warning("invalid sip_profile or sip_to, sofia_contact " .. destination .. " returned " .. contact);
        return
    end

    local event = freeswitch.Event("CUSTOM", "SMS::SEND_MESSAGE");
    event:addHeader("proto", "sip");
    event:addHeader("dest_proto", "sip");
    event:addHeader("blocking", "true");
    event:addHeader("sip_profile", sip_profile);
    event:addHeader("from", "autoreply@" .. domain_name);
    event:addHeader("from_full", "sip:autoreply@" .. domain_name);
    event:addHeader("to", sip_to);
    event:addHeader("type", content_type);
    event:addBody(body);
    cm.debug(event:serialize());
    event:fire();