[SR-Users] DMQ broadcasting crashes kamailio

Charles Chance charles.chance at sipcentric.com
Fri Apr 24 00:42:07 CEST 2020


Hi,

This looks like it could be a combination of a couple of things - one being
a possible bug in the DMQ code, and the other not handling the
script-generated message correctly.

If we rule out the latter first, I can take a look at the possible bug
after.

For in-script communication over DMQ you should not call
dmq_handle_message() since there will not be a registered peer/handler for
the message. The idea is to handle it in script on the receiver side
instead.

You do, however, need to call dmq_handle_message() for handling the
built-in peer notifications and module-to-module communication.

So in your case it may look something like:

    if(is_method("KDMQ")){
        if($rU =~ "userOnline"){
            //user came online in cluster, resume transactions if-any
suspended
            $avp(remoteUser) = $rb;
        } else {
            dmq_handle_message();
        }
    }

Let me know how that goes and in the meantime I will grab the core dump and
take a look into the segfault.

All the best,

Charles


On Thu, 23 Apr 2020 at 22:38, SamyGo <govoiper at gmail.com> wrote:

> Hi,
>
> Is there a way to broadcast KDMQ to the cluster but not expect a reply
> back !?as far as I've read the source code dmq_bcast_message is exactly
> like dmq_send_message in a way that it expects a callback to be executed on
> response i.e expects a reply.
>
> So, the situation I'm facing is I'm broadcasting message to cluster and I
> do not want a reply back. The following two options result in crash & core
> dump.
>
> 1 - If my script doesn't respond back, by use of dmq_handle_message, it
> marks the destined servers as "inactive" and stops usrloc sync process
> which isn't desirable.
> 2 - If I respond back with the dmq_handle_message it crashes the Kamailio
> which just received this broadcasted message.
>
> Here is how its done in script:
>
> *broadcasting message to cluster:*
>         dmq_bcast_message("userOnline", "$fu", "text/plain");
>
> *Receiving and handling a broadcast message:*
> route[DMQ_HANDLE] {
>     if(!(is_method("KDMQ") || $rm == "KDMQ")) return;
>
>     if(is_method("KDMQ") || $rm == "KDMQ"){
>             if($rU =~ "userOnline"){
>                     //user came online in cluster, resume transactions
> if-any suspended
>                     $avp(remoteUser) = $rb;
>             }
>             dmq_handle_message();
>             exit;
>     }
> }
>
> *Related log lines:*
> Apr 23 21:15:48  kamailio[916]: ALERT: <script>: [da2c1-2f499] ------
> DMQ_HANDLE: UserOnline Event Received ------
> Apr 23 21:15:48  kamailio[916]: DEBUG: dmq [message.c:53]:
> ki_dmq_handle_message_rc(): dmq_handle_message [KDMQ
> sip:userOnline at 9.8.7.123:5060]
> Apr 23 21:15:48  kamailio[916]: DEBUG: dmq [message.c:66]:
> ki_dmq_handle_message_rc(): dmq_handle_message peer found: userOnline
> Apr 23 21:15:48  kamailio[916]: DEBUG: <core> [core/receive.c:437]:
> receive_msg(): request-route executed in: 401461 usec
> Apr 23 21:15:48  kamailio[935]: DEBUG: dmq [worker.c:87]: worker_loop():
> dmq_worker [2 935] lock acquired
> and crash/segfault..
>
> Core dump: https://pastebin.com/S7ekCPfF
>
> Any help or pointers to solve this would be really appreciated.
>
> Best Regards,
> Sammy
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>

-- 
Sipcentric Ltd.
                Company registered in England & Wales no. 
7365592. Registered
                office: Faraday Wharf, Innovation 
Birmingham Campus, Holt Street, Birmingham Science Park, Birmingham B7 4BB.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200423/69fb5c85/attachment.html>


More information about the sr-users mailing list