On May 07, 2009 at 14:03, Henning Westerholt henning.westerholt@1und1.de wrote:
On Mittwoch, 8. April 2009, Andrei Pelinescu-Onciul wrote:
[..] (modules init and starting processes is documented in doc/modules_init.txt).
Hi Andrei,
also related to this topic: I did a few tests with the dialog module today. This module checks if it opens a DB connection two times in child_init. I noticed that for the PROC_MAIN process child_init is called two times. Is this correct?
Yes, it's called once with rank PROC_INIT, before forking (so everything done here will be inherited by all the processes) and another time with PROC_MAIN (here is the right place for forking other processes that need tcp access).
In kamailio child_init for PROC_MAIN is only called one time, thus many modules open DB connections also for the main process.
DB connections should not be opened for PROC_INIT, PROC_MAIN or PROC_TCP_MAIN. Depending on what one wants to do with the DB connections, they might not need to be opened also for PROC_RPC/PROC_FIFO/PROC_UNIXSOCK (but then no DB access will be possible from the rpc/fifo interface) and maybe PROC_TIMER (if you never use the DB connection from a timer).
Andrei