[sr-dev] [kamailio/kamailio] Segfault in t_reply of Kamailio v5.2.2 rev. 9bc44f (#2055)

Muhammad Shahzad Shafi notifications at github.com
Fri Sep 13 10:33:16 CEST 2019


Here is the code fragment that was executing in async process when crash happened,

```
            xlog("L_NOTICE", "[$pr:$fU@$si:$sp]: Found '$avp(rows)' db records for SIP SCI command '$avp(sip_sci_cmd)' \n");
	    append_to_reply("X-Message-Count: $avp(rows)\r\n");
            $avp(reason) = "Accepted: sending " + $avp(rows) + " messages";
            send_reply("201", "$avp(reason)");
...
            perl_exec("get_chat_sessions", $fU);
            xlog("L_INFO", "[$pr:$fU@$si:$sp]: Updated Chat History Summary: $avp(new_body) \n");

            #### self message with json body ####
            $uac_req(all)=$null;
            $uac_req(method)="MESSAGE";
            $uac_req(furi)=$fu;
            $uac_req(turi)=$fu;
            #$uac_req(evroute)=1;
            $uac_req(callid)=$uuid(r);
            $uac_req(hdrs)="Content-Type: application/json\r\nDate: " + $TF + "\r\n";
            $uac_req(body)=$avp(new_body);

            $uac_req(ruri)=$avp(sender_ruri);
            $uac_req(ouri)=$avp(sender_duri);
            $uac_req(sock)=$avp(sender_sock);

            uac_req_send();
```

Note that variable **$avp(new_body)** was set by PERL script. There is a theory from one of my developers is that since REDIS failed to connect so this variable was never set and when UAC tried to set NULL as JSON body for SIP MESSAGE request, the crashed must have happened. However, the core dump attached in this ticket does not confirm that.

This resulted in this syslog messages,

```
Sep  3 02:59:56 webrtc-service kamailio[5987]: NOTICE: <script>: [wss:xxxxxxxx at x.x.x.x:52025]: Found '26' db records for SIP SCI command 'chat_summary'
Sep  3 03:02:03 webrtc-service kamailio[5987]: ERROR: app_perl [kamailioxs.xs:1041]: XS_Kamailio__Message_log(): perl error: Could not connect to Redis server at 172.16.x.x:6379: Connection timed out at /usr/share/perl5/Redis.pm line 420#012#011Redis::__build_sock('Redis=HASH(0x93a1948)') called at /usr/share/perl5/Redis.pm line 407#012#011eval {...} called at /usr/share/perl5/Redis.pm line 407#012#011Redis::__connect('Redis=HASH(0x93a1948)') called at /usr/share/perl5/Redis.pm line 65#012#011Redis::new('Redis', 'server', '172.16.x.x:6379', 'reconnect', 2, 'every', 100, 'encoding', undef, ...) called at /usr/local/kamailio/etc/kamailio/chat_history.pl line 2272#012#011main::get_chat_sessions('Kamailio::Message=SCALAR(0x8cddb64)', 502100012130) called at /usr/local/kamailio/etc/kamailio/chat_history.pl line 0#012#011eval{...} called at /usr/local/kamailio/etc/kamailio/chat_history.pl line 0#012#011...propagated at /usr/share/perl5/Redis.pm line 410.#012
Sep  3 03:02:03 webrtc-service kernel: [7785063.653846] kamailio[5987]: segfault at 318 ip b4ec
```

Let know if you have any further queries.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2055#issuecomment-531150585
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20190913/faa8fe22/attachment.html>


More information about the sr-dev mailing list