event route callback - the name of the Python function to be executed instead of module specific event_route blocks is provided via event_callback parameter of that module
Hello,
not sure I got right what is the issue and what would be a solution for it, but maybe you can leverage evrexec to create a child process and by that keep it in kamailio children list.
Cheers,
Daniel
On 13.09.22 19:15, Marat Gareev wrote:
Hello!
I'm trying to use app_python module to perform periodic actions.
This is a simple python codedef _update():while True:_action()time.sleep(60)class noop_handler:def child_init(self, rank):return 0def ksr_request_route(self, msg):return 1def mod_init():# signal.signal(signal.SIGTERM, signal.default_int_handler)proc = multiprocessing.Process(target=_update)# proc.daemon = Trueproc.start()ksr.notice('Forked process {} to update\n'.format(proc.pid))return noop_handler()
After killing kamailio processes with SIGTERM signal (killall kamailio) I see zombie process.And if I try to process the signal in daemon mode (see the comments in the snippet above), I get critical errors in the logs and still see processes:0(37001) NOTICE: <core> [core/kemi.c:124]: sr_kemi_core_notice(): Forked process 37002 to update1(37003) ERROR: <core> [core/udp_server.c:464]: udp_rcv_loop(): recvfrom:[4] Interrupted system callProcess Process-1:Traceback (most recent call last):File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrapself.run()File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in runself._target(*self._args, **self._kwargs)File "/tmp/script.py", line 155, in _updatetime.sleep(period)KeyboardInterrupt0(37001) ALERT: <core> [main.c:774]: handle_sigs(): child process 37002 exited normally, status=10(37001) INFO: <core> [main.c:802]: handle_sigs(): terminating due to SIGCHLD1(37003) ERROR: <core> [core/udp_server.c:464]: udp_rcv_loop(): recvfrom:[4] Interrupted system call8(37014) CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 41(37003) ERROR: <core> [core/udp_server.c:464]: udp_rcv_loop(): recvfrom:[4] Interrupted system call
So, how I can kill child process by SIGTERM signal?
__________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda