On Tue, Feb 20, 2018 at 04:35:01PM +0100, Daniel-Constantin Mierla wrote:
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.
When a worker process is executing a script, it checks if the local
value matches the one from shared memory. If different, then it should
reload the script before executing it.
Hi, I cannot see the reload taking effect in the workers, only in the child of rank -2
I have a test script that prints out a "version" number. When I increment
the version number and use kamcmd app_python.reload I can see it reloaded in
one child (rank -2, RPC server?). The other workers don't seem to check the version
number and
reload themselves.
# Start: version == 9
# this from master: 9 is version
INFO: <core> [core/kemi.c:91]: sr_kemi_core_info(): 9
/usr/local/etc/kamailio/handler.py is loaded
# this from each child, 9 is version, last digit is rank of child
INFO: <core> [core/kemi.c:91]: sr_kemi_core_info(): 9 child is launched 0
INFO: <core> [core/kemi.c:91]: sr_kemi_core_info(): 9 child is launched 1
INFO: <core> [core/kemi.c:91]: sr_kemi_core_info(): 9 child is launched 2
# process some SIP... print version:rank and From: header
# it seems that the SIP workers are ranks 1,2 not -2
INFO: <core> [core/kemi.c:91]: sr_kemi_core_info(): 9:1
<sip:testing@example.com>;tag=5aecee01-7109-481d-9b20-4beab44f0928
# repeat until all workers have at least run the script once
# Update: version == 10, reload script...
INFO: app_python3 [apy_kemi.c:1204]: app_python_rpc_reload(): marking for reload js script
file: /usr/local/etc/kamailio/handler.py (0 => 0)
INFO: <core> [core/kemi.c:91]: sr_kemi_core_info(): 10
/usr/local/etc/kamailio/handler.py is loaded
INFO: <core> [core/kemi.c:91]: sr_kemi_core_info(): 10 child is launched -2
I see that the child of rank -2 has reloaded and prints 10 (the new version)
However workers of rank 1, 2 use old script (the RPC reload command is not propagated)
# from worker 2
INFO: <core> [core/kemi.c:91]: sr_kemi_core_info(): 9:2
<sip:testing@example.com>;tag=8eb80965-879d-4cef-bcc0-76e45e485821
The script version is checked in apy_reload_script(); this seems to be run directly in the
RPC server(?)(rank: -2) but
I can't see where it schedules apy_reload_script() in the other workers.
Anthony