<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi,<br>
      <br>
      This was fixed starting with 1.11, so you should upgrade your
      version as 1.8 is deprecated.<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 18.01.2016 20:22, Gunjan Korlekar
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAGLL2fuzZR4OCqf4b-CcKW_sjB6kZPU2AD_Gn_C-otUArQCcSA@mail.gmail.com"
      type="cite">
      <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 'dispatcher reload'
          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("no
            dispatching data in the db -- empty destination set\n");</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 'fifo ds_list' command never updated
          after the 'dispatcher rmgw'.</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
              moz-do-not-send="true" href="mailto:bogdan@opensips.org"
              target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:bogdan@opensips.org">bogdan@opensips.org</a></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 moz-do-not-send="true" 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 'opensipsctl dispatcher rmgw' command also
                        runs a 'ds_reload' 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 'fifo ds_list' 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
                              moz-do-not-send="true"
                              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 moz-do-not-send="true"
                              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 'fifo
                            ds_reload' explicitly after 'dispatcher
                            rmgw' 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
                            moz-do-not-send="true"
                            href="mailto:bogdan@opensips.org"
                            target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:bogdan@opensips.org">bogdan@opensips.org</a></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 "opensipsctl fifo ds_list" (via
                              MI command) gets data from memory cache
                              while the "opensipsctl dispatcher show"
                              simply dumps db content.<br>
                              <br>
                              Regards,<br>
                            </tt>
                            <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" 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
                                          moz-do-not-send="true"
                                          href="http://2.2.2.4:5060/"
                                          target="_blank">2.2.2.4:5060</a> 0

                                        'test1'</div>
                                      <div> ./opensipsctl dispatcher
                                        addgw 40 sip:<a
                                          moz-do-not-send="true"
                                          href="http://2.2.2.5:5060/"
                                          target="_blank">2.2.2.5:5060</a> 0

                                        'test1'</div>
                                      <div> ./opensipsctl dispatcher
                                        addgw 40 sip:<a
                                          moz-do-not-send="true"
                                          href="http://2.2.2.6:5060/"
                                          target="_blank">2.2.2.6:5060</a> 0

                                        'test1'</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 moz-do-not-send="true"
                                            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 moz-do-not-send="true"
                                            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 moz-do-not-send="true"
                                            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
                                            moz-do-not-send="true"
                                            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
                                            moz-do-not-send="true"
                                            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
                                            moz-do-not-send="true"
                                            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 'dispatcher
                                        show' 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 moz-do-not-send="true"
                                            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 moz-do-not-send="true"
                                            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
                                            moz-do-not-send="true"
                                            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
                                            moz-do-not-send="true"
                                            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 moz-do-not-send="true"
                                            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
                                            moz-do-not-send="true"
                                            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 moz-do-not-send="true"
                                            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 moz-do-not-send="true"
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 moz-do-not-send="true" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a moz-do-not-send="true" 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>
    </blockquote>
    <br>
  </body>
</html>