<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">After migrate an old server from debian jessie to debian buster, hit a problem of cpu load increasing and block the server at 100% of cpu usage. I notice that was the number of postgresql open process.</div><div class=""><br class=""></div><div class="">Doing a simple sipp of 40cps to stress the server I notice that the problem is in a lua script, the script check if the caller is a table (database postgres) and allows or not the call.</div><div class="">in debian jessie the db handles open (using db_cache status) are  less than 20, but now in debian buster it scales to more that 100, and I start to see error messages that postgress cannot open more connections (that is true I’ve limited to 100 connections).</div><div class=""><br class=""></div><div class="">Anyone experience this problem?</div><div class=""><br class=""></div><div class="">I also try to set the max-db-handles open to 50, in switch.xml, but it ignores this parameter - I think that is only use in internal modules and not for lua scripts… </div><div class="">Can I limit the number of open connections when using FS dbh?</div><div class=""> </div><div class=""><br class=""></div><div class="">The function I get to fetch the result:</div><div class="">filename = "<a href="pgsql://host=/var/run/postgresql/" class="">pgsql://host=/var/run/postgresql/</a> user=postgres dbname=list"</div><div class=""><br class=""></div><div class=""><div class="">callback_query_fetch = function (row)</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>if (single_row == true) then</div><div class=""><span class="Apple-tab-span" style="white-space:pre">              </span>result = row</div><div class=""><span class="Apple-tab-span" style="white-space:pre">              </span>return 1 -- break the loop</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>end</div><div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>if (result == false) then result = {} end</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>table.insert(result, row)</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>return 0</div><div class="">end</div></div><div class=""><br class=""></div><div class=""><div class="">function db.fetch_single(filename, sql)</div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span>local dbh = freeswitch.Dbh(filename)</div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>result = false</div><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>single_row = true</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>if (dbh:query(sql, callback_query_fetch) == false) then</div><div class=""><span class="Apple-tab-span" style="white-space:pre">           </span>dbh:release()</div><div class=""><span class="Apple-tab-span" style="white-space:pre">             </span>return false</div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>end</div><div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>dbh:release()</div><div class=""><span class="Apple-tab-span" style="white-space:pre">     </span>return result</div><div class="">end</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">--<br class="Apple-interchange-newline">Saludos / Regards / Cumprimentos</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">António Silva</div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>

<br class=""></div></body></html>