[OpenSIPS-Users] infinite loop in rtpengine rtpe_function_call()

Alexander Kogan akogan at 5gfuture.com
Thu Feb 22 19:43:40 UTC 2024


Hi,

The OpenSIPS process gets stack in infinite loop when the rtpengine 
module runs out of memory in send_rtpe_command()

Please review the following piece of code in rtpengine.c:

     RTPE_START_READ();
     do {
         if (snode && snode->s) {
             if ((node = get_rtpe_node(snode, set)) == NULL && op == 
OP_OFFER)
                 node = select_rtpe_node(ng_flags.call_id, 1, set);
             snode = NULL;
         } else {
             node = select_rtpe_node(ng_flags.call_id, 1, set);
         }
         if (!node) {
             LM_ERR("no available proxies\n");
             RTPE_STOP_READ();
             goto error;
         }

         cp = send_rtpe_command(node, ng_flags.dict, &ret);
     } *while (cp == NULL);*
     RTPE_STOP_READ();
     LM_DBG("proxy reply: %.*s\n", ret, cp);

When send_rtpe_command() returns NULL due to memory absence here:

     v = bencode_iovec(dict, &vcnt, 1, 0);
     if (!v) {
         LM_ERR("error converting bencode to iovec\n");
         return NULL;
     }

the mentioned loop ( *do {....} while(cp == NULL)* ) won't stop 
indefinitely causing the opensips process to become stuck.

Best regards,
Alexander Kogan,
Director of R&D
5g Future
http://5gfuture.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20240222/819227a6/attachment.html>


More information about the Users mailing list