<div dir="ltr">Hi Bogdan,<div><br></div><div>Thanks for the tip! I checked the opensips logs and I saw the following message when we executed a &#39;dispatcher reload&#39; command - </div><div><br></div><div>WARNING:dispatcher:ds_load_db: no dispatching data in the db -- empty destination set<br></div><div><br></div><div>Digging into the code for the ds_load_db function in dispatch.c I found the following -</div><div><br></div><div><div>if(nr_rows == 0)</div><div><span style="white-space:pre-wrap">        </span>{</div><div><span style="white-space:pre-wrap">                </span>LM_WARN(&quot;no dispatching data in the db -- empty destination set\n&quot;);</div><div><span style="white-space:pre-wrap">                </span>ds_dbf.free_result(ds_db_handle, res);</div><div><span style="white-space:pre-wrap">                </span>return 0;</div><div><span style="white-space:pre-wrap">        </span>}</div></div><div><br></div><div>So, essentially when the dispatcher table is empty, the reload function does not sync the secondary memory with the primary and returns, which causes stale data to remain in the primary, which is why &#39;fifo ds_list&#39; command never updated after the &#39;dispatcher rmgw&#39;.</div><div><br></div><div>Is there a patch or a fix you can provide for the above in the opensips 1.8 version of the source?</div><div><br></div><div>Thanks,</div><div>Gunjan</div><div>   </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 15, 2016 at 1:31 AM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <tt>Hi Gunjan,<br>
      <br>
      have you checked the opensips logs for any potential errors ?
      maybe the reload fails.<br>
      <br>
      Regards,<br>
    </tt><span class="">
    <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
    </span><div><div class="h5"><div>On 14.01.2016 19:10, Gunjan Korlekar
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi Bogdan,
        <div><br>
        </div>
        <div>Thanks for the clarification regarding the memory and the
          ds_list command.</div>
        <div> </div>
        <div>From what I see in the opensipsctl source, the &#39;opensipsctl
          dispatcher rmgw&#39; command also runs a &#39;ds_reload&#39; after running
          the database query to remove the entry. Hence in my above
          sequence of operations, the primary storage should have synced
          with the secondary storage before I ran &#39;fifo ds_list&#39; and
          should not have expected data in the ds_list output -</div>
        <div><br>
        </div>
        <div>
          <div style="font-size:12.8px">
            <div>./opensipsctl dispatcher show</div>
            <div>dispatcher gateways</div>
            <div>+----+-------+------------------+--------+-------+--------+-------+-------------+</div>
            <div>| id | setid | destination      | socket | flags |
              weight | attrs | description |</div>
            <div>+----+-------+------------------+--------+-------+--------+-------+-------------+</div>
            <div>|  5 |    40 | sip:<a href="http://2.2.2.6:5060/" target="_blank">2.2.2.6:5060</a> |
              NULL   |     0 |      1 |       | test1       |</div>
            <div>+----+-------+------------------+--------+-------+--------+-------+-------------+</div>
            <div><br>
            </div>
            <div> ./opensipsctl dispatcher rmgw 5 &lt;&lt;&lt;&lt;------
              ds_reload here</div>
            <div> ./opensipsctl fifo ds_list &lt;&lt;&lt;----- should
              show synced output ?<br>
            </div>
            <div>SET_NO:: 1</div>
            <div>SET:: 40</div>
            <div><span style="white-space:pre-wrap">        </span>URI:: sip:<a href="http://2.2.2.6:5060/" target="_blank">2.2.2.6:5060</a> flag=A</div>
            <div> ./opensipsctl dispatcher show</div>
            <div>dispatcher gateways</div>
            <div><br>
            </div>
            <div>I tried the above by running &#39;fifo ds_reload&#39;
              explicitly after &#39;dispatcher rmgw&#39; as well. However I did
              not see a difference in the result. Can you please help in
              understanding the issue?</div>
            <div><br>
            </div>
            <div>Thanks,</div>
            <div>Gunjan</div>
          </div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Thu, Jan 14, 2016 at 1:39 AM,
          Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@opensips.org" target="_blank"></a><a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>&gt;</span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000"> <tt>Hi Gunjan,<br>
                <br>
                In dispatcher there are 2 storages:<br>
                    - primary storage which is in memory<br>
                    - secondary storage (read only at startup or reload)
                which is the DB<br>
                <br>
                First is about synchronizing the 2 storages (from
                secondary to primary via a ds_reload command). AFter
                that is about which storage you are querying for data.
                Like the &quot;opensipsctl fifo ds_list&quot; (via MI command)
                gets data from memory cache while the &quot;opensipsctl
                dispatcher show&quot; simply dumps db content.<br>
                <br>
                Regards,<br>
              </tt>
              <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
              <div>
                <div>
                  <div>On 14.01.2016 03:44, Gunjan Korlekar wrote:<br>
                  </div>
                </div>
              </div>
              <blockquote type="cite">
                <div>
                  <div>
                    <div dir="ltr"><span style="font-size:12.8px">Hello,</span>
                      <div style="font-size:12.8px"><br>
                      </div>
                      <div style="font-size:12.8px">I am observing some
                        unusual behavior of the ds_list command when
                        adding and removing gateways in the dispatcher
                        table for opensips 1.8</div>
                      <div style="font-size:12.8px"><br>
                      </div>
                      <div style="font-size:12.8px">I am running the
                        following sequence of commands -</div>
                      <div style="font-size:12.8px"><br>
                      </div>
                      <div style="font-size:12.8px">
                        <div>./opensipsctl dispatcher addgw 40 sip:<a href="http://2.2.2.4:5060/" target="_blank">2.2.2.4:5060</a> 0
                          &#39;test1&#39;</div>
                        <div> ./opensipsctl dispatcher addgw 40 sip:<a href="http://2.2.2.5:5060/" target="_blank">2.2.2.5:5060</a> 0
                          &#39;test1&#39;</div>
                        <div> ./opensipsctl dispatcher addgw 40 sip:<a href="http://2.2.2.6:5060/" target="_blank">2.2.2.6:5060</a> 0
                          &#39;test1&#39;</div>
                        <div><br>
                        </div>
                        <div>When I view the dispatcher list using
                          ds_list I see-</div>
                        <div> ./opensipsctl fifo ds_list</div>
                        <div>
                          <div>SET_NO:: 1</div>
                          <div>SET:: 40</div>
                          <div><span style="white-space:pre-wrap">        </span>URI::
                            sip:<a href="http://2.2.2.4:5060/" target="_blank">2.2.2.4:5060</a> flag=A</div>
                          <div><span style="white-space:pre-wrap">        </span>URI::
                            sip:<a href="http://2.2.2.5:5060/" target="_blank">2.2.2.5:5060</a> flag=A</div>
                          <div><span style="white-space:pre-wrap">        </span>URI::
                            sip:<a href="http://2.2.2.6:5060/" target="_blank">2.2.2.6:5060</a> flag=A</div>
                        </div>
                        <div>and the ./opensipsctl dispatcher show
                          output is as follows -</div>
                        <div>
                          <div>dispatcher gateways</div>
                          <div>+----+-------+------------------+--------+-------+--------+-------+-------------+</div>
                          <div>| id | setid | destination      | socket
                            | flags | weight | attrs | description |</div>
                          <div>+----+-------+------------------+--------+-------+--------+-------+-------------+</div>
                          <div>|  3 |    40 | sip:<a href="http://2.2.2.4:5060/" target="_blank">2.2.2.4:5060</a> | NULL  
                            |     0 |      1 |       | test1       |</div>
                          <div>|  4 |    40 | sip:<a href="http://2.2.2.5:5060/" target="_blank">2.2.2.5:5060</a> | NULL  
                            |     0 |      1 |       | test1       |</div>
                          <div>|  5 |    40 | sip:<a href="http://2.2.2.6:5060/" target="_blank">2.2.2.6:5060</a> | NULL  
                            |     0 |      1 |       | test1       |</div>
                          <div>+----+-------+------------------+--------+-------+--------+-------+-------------+</div>
                        </div>
                        <div><br>
                        </div>
                        <div>However when I remove the 3 gateways one
                          after another using the ./opensipsctl
                          dispatcher rmgw command. I see that the
                          gateway that was removed last can still be
                          seen in the ds_list command even though
                          &#39;dispatcher show&#39; does not show any gateways
                          present. Here is the sequence of commands I am
                          executing-</div>
                        <div><br>
                        </div>
                        <div>
                          <div> ./opensipsctl dispatcher rmgw 3</div>
                          <div>./opensipsctl fifo ds_list<br>
                          </div>
                          <div>SET_NO:: 1</div>
                          <div>SET:: 40</div>
                          <div><span style="white-space:pre-wrap">        </span>URI::
                            sip:<a href="http://2.2.2.5:5060/" target="_blank">2.2.2.5:5060</a> flag=A</div>
                          <div><span style="white-space:pre-wrap">        </span>URI::
                            sip:<a href="http://2.2.2.6:5060/" target="_blank">2.2.2.6:5060</a> flag=A</div>
                          <div> ./opensipsctl dispatcher show</div>
                          <div>dispatcher gateways</div>
                          <div>+----+-------+------------------+--------+-------+--------+-------+-------------+</div>
                          <div>| id | setid | destination      | socket
                            | flags | weight | attrs | description |</div>
                          <div>+----+-------+------------------+--------+-------+--------+-------+-------------+</div>
                          <div>|  4 |    40 | sip:<a href="http://2.2.2.5:5060/" target="_blank">2.2.2.5:5060</a> | NULL  
                            |     0 |      1 |       | test1       |</div>
                          <div>|  5 |    40 | sip:<a href="http://2.2.2.6:5060/" target="_blank">2.2.2.6:5060</a> | NULL  
                            |     0 |      1 |       | test1       |</div>
                          <div>+----+-------+------------------+--------+-------+--------+-------+-------------+</div>
                          <div><br>
                          </div>
                          <div> ./opensipsctl dispatcher rmgw 4</div>
                          <div> ./opensipsctl fifo ds_list<br>
                          </div>
                          <div>SET_NO:: 1</div>
                          <div>SET:: 40</div>
                          <div><span style="white-space:pre-wrap">        </span>URI::
                            sip:<a href="http://2.2.2.6:5060/" target="_blank">2.2.2.6:5060</a> flag=A</div>
                          <div> ./opensipsctl dispatcher show</div>
                          <div>dispatcher gateways</div>
                          <div>+----+-------+------------------+--------+-------+--------+-------+-------------+</div>
                          <div>| id | setid | destination      | socket
                            | flags | weight | attrs | description |</div>
                          <div>+----+-------+------------------+--------+-------+--------+-------+-------------+</div>
                          <div>|  5 |    40 | sip:<a href="http://2.2.2.6:5060/" target="_blank">2.2.2.6:5060</a> | NULL  
                            |     0 |      1 |       | test1       |</div>
                          <div>+----+-------+------------------+--------+-------+--------+-------+-------------+</div>
                          <div><br>
                          </div>
                          <div> ./opensipsctl dispatcher rmgw 5</div>
                          <div> ./opensipsctl fifo ds_list<br>
                          </div>
                          <div>SET_NO:: 1</div>
                          <div>SET:: 40</div>
                          <div><span style="white-space:pre-wrap">        </span>URI::
                            sip:<a href="http://2.2.2.6:5060/" target="_blank">2.2.2.6:5060</a> flag=A</div>
                          <div> ./opensipsctl dispatcher show</div>
                          <div>dispatcher gateways</div>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div>Can you please help in understanding this
                          behavior? Is this expected behavior? Is there
                          something I am missing that needs to be done
                          to correct this?</div>
                        <div>
                          <div><img src="https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif"></div>
                        </div>
                      </div>
                      <div><br>
                      </div>
                      -- <br>
                      <div>
                        <div dir="ltr">Thanks,
                          <div>Gunjan</div>
                        </div>
                      </div>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                  </div>
                </div>
                <pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
              </blockquote>
              <br>
            </div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div>
          <div dir="ltr">Thanks,
            <div>Gunjan</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Thanks,<div>Gunjan</div></div></div>
</div>