<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi,</p>
    <p>The OpenSIPS process gets stack in infinite loop when the
      rtpengine module runs out of memory in send_rtpe_command()</p>
    <p>Please review the following piece of code in rtpengine.c:</p>
    <p><font face="monospace">    RTPE_START_READ();<br>
            do {<br>
                if (snode && snode->s) {<br>
                    if ((node = get_rtpe_node(snode, set)) == NULL
        && op == OP_OFFER)<br>
                        node = select_rtpe_node(ng_flags.call_id, 1,
        set);<br>
                    snode = NULL;<br>
                } else {<br>
                    node = select_rtpe_node(ng_flags.call_id, 1, set);<br>
                }<br>
                if (!node) {<br>
                    LM_ERR("no available proxies\n");<br>
                    RTPE_STOP_READ();<br>
                    goto error;<br>
                }<br>
        <br>
                cp = send_rtpe_command(node, ng_flags.dict, &ret);<br>
            } <b>while (cp == NULL);</b><br>
            RTPE_STOP_READ();<br>
            LM_DBG("proxy reply: %.*s\n", ret, cp);</font><br>
    </p>
    <p>When send_rtpe_command() returns NULL due to memory absence here:</p>
    <p><font face="monospace">    v = bencode_iovec(dict, &vcnt, 1,
        0);<br>
            if (!v) {<br>
                LM_ERR("error converting bencode to iovec\n");<br>
                return NULL;<br>
            }</font><br>
    </p>
    <p>the mentioned loop ( <b>do {....} while(cp == NULL)</b> ) won't
      stop indefinitely causing the opensips process to become stuck.</p>
    <pre class="moz-signature" cols="72">Best regards,
Alexander Kogan,
Director of R&D
5g Future
<a class="moz-txt-link-freetext" href="http://5gfuture.com">http://5gfuture.com</a></pre>
  </body>
</html>