During init, the kazoo module performs forking for "AMQP Consumer Worker". The ranks for all this process are incremented one by one, starting with value 1. Value 1 is defined as PROC_SIPINIT and has a special meaning for most of the regular modules. One side effect of this is that the registration records are loaded from the db twice! One simple fix would be to fork all the workers with a PROC_NOCHLDINIT ranking.
Proposed patch: ```` --- a/src/modules/kazoo/kazoo.c +++ b/src/modules/kazoo/kazoo.c @@ -369,7 +369,7 @@ static int mod_child_init(int rank) */
for(i=0; i < dbk_consumer_workers; i++) { - pid=fork_process(i+1, "AMQP Consumer Worker", 1); + pid=fork_process(PROC_NOCHLDINIT, "AMQP Consumer Worker", 1); if (pid<0) return -1; /* error */ if(pid==0){ ````
@ovidiusas thanks. fixed in master and 4.4
Closed #972.
Reopened #972.
your fix does not work, the consumer workers need db initialization.
Maybe they should be started with PROC_RPC or PROC_SIPINIT+1+i.
Just like we have PROC_SIPRPC, maybe we should have PROC_GENERICWORKER. The PROC_GENERICWORKER could be an alias to PROC_SIPRPC and then all workers should be initialized with the same rank and there will be no hard coding (the +1).
I tested this and it's working. My initial test was done with modparam("kazoo", "pua_mode", 0) and it didn't catch the db non initialization issue of the "AMQP Consumer Worker" .
Also, having the new PROC_GENERICWORKER would solve all the other hardcoded places in other modules.
that's what i ended up doing :) thanks for the confirmation & testing
On Wed, Feb 8, 2017 at 7:20 PM, Ovidiu Sas notifications@github.com wrote:
Just like we have PROC_SIPRPC, maybe we should have PROC_GENERICWORKER. The PROC_GENERICWORKER could be an alias to PROC_SIPRPC and then all workers should be initialized with the same rank and there will be no hard coding (the +1).
I tested this and it's working. My initial test was done with modparam("kazoo", "pua_mode", 0) and it didn't catch the db non initialization issue of the "AMQP Consumer Worker" .
Also, having the new PROC_GENERICWORKER would solve all the other hardcoded places in other modules.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/kamailio/kamailio/issues/972#issuecomment-278432817, or mute the thread https://github.com/notifications/unsubscribe-auth/AAvDrHh5Z5o-Es7FjnTx0FR0blDPUVAOks5rahVzgaJpZM4L5phZ .
I added PROC_SIPWORKER with value 2 which should allow checking if a sip worker is special (like SIPINIT) or just normal one.
I am fine adding another one like proposed above, just use a shorter name, like PROC_GENWORKER or maybe PROC_XWORKER or PROC_EXTWORKER, coming from 'eXtension' worker, more suggestive for its purpose used by kamailio extensions. Generic is too generic :-)
Closed #972.
Fixed in trunk via commit b66df87adde282c3eaa7ab793c598bfe67f8f9a1