<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'Lucida Console'; font-size:9pt; font-weight:400; font-style:normal;">On Donnerstag, 7. Mai 2009, Andrei Pelinescu-Onciul wrote:<br>
&gt; &gt; also related to this topic: I did a few tests with the dialog module<br>
&gt; &gt; today. This module checks if it opens a DB connection two times in<br>
&gt; &gt; child_init. I noticed that for the PROC_MAIN process child_init is called<br>
&gt; &gt; two times. Is this correct?<br>
&gt;<br>
&gt; Yes, it's called once with rank PROC_INIT, before forking<br>
&gt; (so everything done here will be inherited by all the processes) and<br>
&gt; another time with PROC_MAIN (here is the right place for forking other<br>
&gt; processes that need tcp access).<br>
&gt;<br>
&gt; &gt; In kamailio child_init for PROC_MAIN is only called one time, thus many<br>
&gt; &gt; modules open DB connections also for the main process.<br>
&gt;<br>
&gt; DB connections should not be opened for PROC_INIT,  PROC_MAIN or<br>
&gt; PROC_TCP_MAIN.  Depending on what one wants to do with the DB connections, <br>
&gt; they might not need to be opened also for PROC_RPC/PROC_FIFO/PROC_UNIXSOCK <br>
&gt; (but then no DB access will be possible from the rpc/fifo interface) and <br>
&gt; maybe PROC_TIMER (if you never use the DB connection from a timer).<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Andrei,<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>ok, then i need to review some modules. :-) For the child_init it should be easy to fix, in the mod_destroy (for db shutdown and such) its perhaps a bit harder.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Henning</p></body></html>