[sr-dev] question on RPC script reload: how is it invoked in the workers?

Anthony Alba ascanio.alba7 at gmail.com
Wed Feb 21 00:59:32 CET 2018


On Tue, Feb 20, 2018 at 04:35:01PM +0100, Daniel-Constantin Mierla wrote:
> Hello,
> 
> the script reload mechanism relies on a counter (version number) stored
> in shared memory. It is set to 0 when kamailio start and increased with
> each RPC reload command.
> 
> Each worker process has a copy of the value in a local variable.
More details:

The script is reloaded only if the process calls the function apy_reload_script().

There are processes which are not SIP workers ranks: 0, -1, -2, -4.
SIP workers have ranks: 1, 2

It would appear that the RPC server is in -2: I can see it reload the script in itself:
it calls apy_reload_script() which calls apy_load_script()/apy_init_script()

However I don't see worker -2 instruct workers 1,2 to run apy_load_script().

What I need is a mechanism to schedule a function call in the workers: something like
// pseudo-code
for (i = 1, i < 3; i++)
   // run_in_worker(int rank, void* function)
   run_in_worker(1, apy_reload_script);


Anthony





More information about the sr-dev mailing list