<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><tt>Hi solarmon,</tt></p>
    <p><tt>Please find an elaborate discussion on this topic here [1]. 
        In short,<br>
        MySQL's "wait_timeout" setting directly affects the number of
        such errors<br>
        you are seeing in the logs, unless you are dealing with some
        other kind of<br>
        a DB problem which causes new connections to be immediately
        dropped<br>
        (e.g. deadlock, internal error, read-only state, etc.).</tt></p>
    <p><tt>Best regards,<br>
      </tt></p>
    <p><tt>[1]: </tt><tt><a
href="http://lists.opensips.org/pipermail/devel/2019-October/026171.html">http://lists.opensips.org/pipermail/devel/2019-October/026171.html</a></tt></p>
    <pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a>

OpenSIPS Summit, Amsterdam, May 2020
  <a class="moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2020Amsterdam/">https://www.opensips.org/events/Summit-2020Amsterdam/</a>
OpenSIPS Bootcamp, Miami, March 2020
  <a class="moz-txt-link-freetext" href="https://opensips.org/training/OpenSIPS_Bootcamp_2020/">https://opensips.org/training/OpenSIPS_Bootcamp_2020/</a></pre>
    <div class="moz-cite-prefix">On 07.01.2020 13:45, solarmon wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOXfywNq_1Yv9+Hv01h3L0ox-VeHFJxf32eG6spruAidfjZ+uQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Hi,<br>
        </div>
        <div><br>
        </div>
        <div>I'm am still getting these database related messages on my
          opensips servers.</div>
        <div><br>
        </div>
        <div>/usr/local/sbin/opensips[29086]:
          <a class="moz-txt-link-freetext" href="INFO:db_mysql:switch_state_to_disconnected">INFO:db_mysql:switch_state_to_disconnected</a>: disconnect event
          for 0x7fb482d108a8<br>
          /usr/local/sbin/opensips[29086]:
          <a class="moz-txt-link-freetext" href="INFO:db_mysql:reset_all_statements">INFO:db_mysql:reset_all_statements</a>: resetting all statements
          on connection: (0x7fb482d11080) 0x7fb482d108a8<br>
          /usr/local/sbin/opensips[29086]:
          <a class="moz-txt-link-freetext" href="INFO:db_mysql:connect_with_retry">INFO:db_mysql:connect_with_retry</a>: re-connected successful for
          0x7fb482d108a8<br>
        </div>
        <div><br>
        </div>
        <div>As per my last post on this subject, the database it is
          using is local to opensips - i.e. running on the same machine
          opensips. Thus, there should be no networking or routing or
          firewall that could be causing connectivity issues.</div>
        <div><br>
        </div>
        <div>Why is opensips generating such logs suggesting that it
          cannot connect to its local database? What could be causing
          this issue - opensips or the (MariaDB) database?</div>
        <div><br>
        </div>
        <div>Thank you. </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Mon, 23 Dec 2019 at 14:49,
          solarmon <<a href="mailto:solarmon@one-n.co.uk"
            moz-do-not-send="true">solarmon@one-n.co.uk</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div dir="ltr">
            <div dir="ltr">Hi,<br>
              <div><br>
              </div>
              <div>Looking at the logs, these
                <a class="moz-txt-link-rfc2396E" href="INFO:db_mysql:switch_state_to_disconnected">"INFO:db_mysql:switch_state_to_disconnected"</a> events do
                occur quite regularly.</div>
              <div><br>
              </div>
              <div>Also note that the database is local to the opensips
                node (part of a two node cluster, with mariadb
                master/master syncing)).</div>
              <div><br>
              </div>
              <div>As per another post (that has not has a response) I'm
                using the 
                "opensipsctl dispatcher show" to monitor the endpoint
                status. I think this is related as I've notice that the
                state shown by "
                "opensipsctl dispatcher show"" and 
                "opensipsctl dispatcher dump" differ:</div>
              <div><br>
              </div>
              <div>When using "opensipsctl dispatcher show":<br>
                <br>
+----+-------+------------------------+-----------------------+-------+--------+----------+-------+--------------+<br>
                | id | setid | destination            | socket          
                     | state | weight | priority | attrs | description
                 |<br>
+----+-------+------------------------+-----------------------+-------+--------+----------+-------+--------------+<br>
                |  1 |     1 | sip:A.B.C.D:5060   | udp:W.X.Y.Z:5060 |  
                  2 | 1      |        0 |       | |<br>
                <br>
                When using "opensipsctl dispatcher dump":<br>
                <br>
                        SET:: 1<br>
                                URI:: sip:A.B.C.D:5060 state=Active
                first_hit_counter=0<br>
                                        socket:: udp:W.X.Y.Z:5060<br>
              </div>
            </div>
            <div><br>
            </div>
            <div>I might change my monitoring script to use 
              "opensipsctl dispatcher dump", but it was easier for me to
              process the tabular format as it contains the destination
              and state in the same line.</div>
            <div><br>
            </div>
            <div>Thanks.</div>
            <br>
            <div class="gmail_quote">
              <div dir="ltr" class="gmail_attr">On Mon, 23 Dec 2019 at
                14:37, Răzvan Crainea <<a
                  href="mailto:razvan@opensips.org" target="_blank"
                  moz-do-not-send="true">razvan@opensips.org</a>>
                wrote:<br>
              </div>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
                0.8ex;border-left:1px solid
                rgb(204,204,204);padding-left:1ex">There are no errors -
                as the level indicates, there are some INFO <br>
                messages indicating that a re-connection is done. Most
                likely the <br>
                database connection was in a stale state, and the driver
                decided to <br>
                reconnect. Nothing wrong about that.<br>
                <br>
                The reason for switching the endpoint in probing mode
                comes from the SIP <br>
                signaling level - you should add more debugging in your
                script to <br>
                understand this problem, or take a look at the signaling
                level.<br>
                <br>
                Best regards,<br>
                <br>
                Răzvan Crainea<br>
                OpenSIPS Core Developer<br>
                <a href="http://www.opensips-solutions.com"
                  rel="noreferrer" target="_blank"
                  moz-do-not-send="true">http://www.opensips-solutions.com</a><br>
                <br>
                On 12/23/19 11:38 AM, solarmon wrote:<br>
                > Hi,<br>
                > <br>
                > I'm investigating why there was a blip in the
                Dispatcher endpoint SIP <br>
                > Options pings. The endpoint went in to "State=2
                (Probing)" state and at <br>
                > the same time the following was logged in
                opensips.log:<br>
                > <br>
                > /usr/local/sbin/opensips[29087]: <br>
                > <a class="moz-txt-link-freetext" href="INFO:db_mysql:switch_state_to_disconnected">INFO:db_mysql:switch_state_to_disconnected</a>:
                disconnect event for <br>
                > 0x7fb482d108a8<br>
                > /usr/local/sbin/opensips[29087]:
                <a class="moz-txt-link-freetext" href="INFO:db_mysql:reset_all_statements">INFO:db_mysql:reset_all_statements</a>: <br>
                > resetting all statements on connection:
                (0x7fb482d11080) 0x7fb482d108a8<br>
                > /usr/local/sbin/opensips[29087]:
                <a class="moz-txt-link-freetext" href="INFO:db_mysql:connect_with_retry">INFO:db_mysql:connect_with_retry</a>: <br>
                > re-connected successful for 0x7fb482d108a8<br>
                > /usr/local/sbin/opensips[29077]: <br>
                > <a class="moz-txt-link-freetext" href="INFO:db_mysql:switch_state_to_disconnected">INFO:db_mysql:switch_state_to_disconnected</a>:
                disconnect event for <br>
                > 0x7fb482d108a8<br>
                > /usr/local/sbin/opensips[29077]:
                <a class="moz-txt-link-freetext" href="INFO:db_mysql:reset_all_statements">INFO:db_mysql:reset_all_statements</a>: <br>
                > resetting all statements on connection:
                (0x7fb482d11080) 0x7fb482d108a8<br>
                > /usr/local/sbin/opensips[29077]:
                <a class="moz-txt-link-freetext" href="INFO:db_mysql:connect_with_retry">INFO:db_mysql:connect_with_retry</a>: <br>
                > re-connected successful for 0x7fb482d108a8<br>
                > <br>
                > Please can somebody advise what these error
                messages mean and how/what <br>
                > to investigate it further and resolve it.<br>
                > <br>
                > Thank you.<br>
                > <br>
                > _______________________________________________<br>
                > Users mailing list<br>
                > <a href="mailto:Users@lists.opensips.org"
                  target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a><br>
                > <a
                  href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
                  rel="noreferrer" target="_blank"
                  moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
                > <br>
                <br>
                _______________________________________________<br>
                Users mailing list<br>
                <a href="mailto:Users@lists.opensips.org"
                  target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a><br>
                <a
                  href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
                  rel="noreferrer" target="_blank"
                  moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
              </blockquote>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
  </body>
</html>