Hi,
i've tried to run some of my tests written for kamailio on kamailio-3.0 in order to check if the modules can be load. With test/2.cfg i've run into this error:
BUG: <core> [pt.c:283]: ERROR: fork_process(): Process limit of 36 exceeded. Will simulate fork fail.
Is this something critical? Why is there a limit on the process number and how can i extend this?
Thanks,
Henning
On Wednesday 08 April 2009, Henning Westerholt wrote:
i've tried to run some of my tests written for kamailio on kamailio-3.0 in order to check if the modules can be load. With test/2.cfg i've run into this error:
BUG: <core> [pt.c:283]: ERROR: fork_process(): Process limit of 36 exceeded. Will simulate fork fail.
Is this something critical? Why is there a limit on the process number and how can i extend this?
This happens only when i include the nathelper module.
Cheers,
Henning
On Apr 08, 2009 at 12:50, Henning Westerholt henning.westerholt@1und1.de wrote:
Hi,
i've tried to run some of my tests written for kamailio on kamailio-3.0 in order to check if the modules can be load. With test/2.cfg i've run into this error:
BUG: <core> [pt.c:283]: ERROR: fork_process(): Process limit of 36 exceeded. Will simulate fork fail.
Is this something critical? Why is there a limit on the process number and how can i extend this?
It's not limited, but every new process must first be registered. In the case of a module, if you want to start 2 processes (for example) you have to call from mod_init: register_procs(2).
This is used to properly size-up the process table. If you don't call it when the number of registered processes is exceeded, fork will fail.
(modules init and starting processes is documented in doc/modules_init.txt).
Another important thing: if one opens file descriptors globally (e.g. from mod_init or child_init(*)), their maximum number should be registered from mod_init with register_fds(no)). Not doing this might result in strange problems at runtime, since there are parts of code that need to know the maximum fd number (e.g. tcp in most cases, the ctl module a.s.o.). There are some very conservative defaults, but it's much safer not to rely on them an register instead the maximum number of fds you'll use.
Andrei
On Wednesday 08 April 2009, Andrei Pelinescu-Onciul wrote:
BUG: <core> [pt.c:283]: ERROR: fork_process(): Process limit of 36 exceeded. Will simulate fork fail.
Is this something critical? Why is there a limit on the process number and how can i extend this?
It's not limited, but every new process must first be registered. In the case of a module, if you want to start 2 processes (for example) you have to call from mod_init: register_procs(2).
This is used to properly size-up the process table. If you don't call it when the number of registered processes is exceeded, fork will fail.
(modules init and starting processes is documented in doc/modules_init.txt). [..]
Hi Andrei,
thanks a lot for the explanation. I've found the error in the nathelper module, the already existing register_procs call was not executed in my test setup.
Cheers,
Henning
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?
In kamailio child_init for PROC_MAIN is only called one time, thus many modules open DB connections also for the main process.
Cheers,
Henning
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
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