<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>have you look at the PID, is it done for the same process? Can
      you send some sample syslog messages?</p>
    <p>Also what is the version of your lua?<br>
    </p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 25.04.18 07:15, Yuriy Gorlichenko
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CABSP_VdBg40gH9LCjQx-SDrb+JEddLNGQsaSHJaXF3Xe38-Gmw@mail.gmail.com">
      <div dir="ltr">Hi<br>
        For now as I see:  every request that calls lua script reevables
        my global lua variables <br>
        <br>
        For example
        <div><br>
          I trying to connect to DB via luasql driver and checking if
          connection already existis to avoid new connection<br>
          <br>
          I have function init() that calls in ksr_request_route()<br>
          <br>
          Inside i have ome check: <br>
          <br>
          if not CON then <br>
          <div><br>
          </div>
          <div>    CON =
assert(MYSQL:connect(DBdata.dbname,DBdata.username,DBdata.password,DBdata.host,DBdata.port))</div>
          <div><br>
          </div>
          <div><span style="white-space:pre">             </span>if not CON then</div>
          <div><span style="white-space:pre">                     </span>KSR.log("info","|init|log|
            DB NOT connected\n")</div>
          <div><span style="white-space:pre">                     </span>KSR.sl.sl_send_reply(503,"Internal
            server error") </div>
          <div><span style="white-space:pre">                     </span>KSR.x.exit()</div>
          <div><span style="white-space:pre">             </span>else </div>
          <div><span style="white-space:pre">                     </span>KSR.log("info","|init|log|
            DB connected\n")</div>
          <div><span style="white-space:pre">             </span>end</div>
          <div>end<br>
            <br>
            So in this case if CON was already created it should not try
            to connect<br>
            <br>
            But for now it tries for every request. So means kemi not
            stores global lua variables between sessions (in one
            kamailio process)<br>
            <br>
            Also as I know INIT routes initiates before lua machine will
            be started so it not allowed to init some lua global
            variables in the init routes<br>
            <br>
            So my question is there is a way to keep global vars per
            kamailio process instead per kamailio request?<br>
            <br>
            <br>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio World Conference - May 14-16, 2018 - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>