On Donnerstag, 7. Mai 2009, Andrei Pelinescu-Onciul wrote:
> > 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,
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.
Henning