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 code > def _update(): > while True: > _action() > time.sleep(60) > class noop_handler: > def child_init(self, rank): > return 0 > def ksr_request_route(self, msg): > return 1 > def mod_init(): > # signal.signal(signal.SIGTERM, signal.default_int_handler) > proc = multiprocessing.Process(target=_update) > # proc.daemon = True > proc.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 update > 1(37003) ERROR: <core> [core/udp_server.c:464]: udp_rcv_loop(): > recvfrom:[4] Interrupted system call > Process Process-1: > Traceback (most recent call last): > File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in > _bootstrap > self.run() > File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run > self._target(*self._args, **self._kwargs) > File "/tmp/script.py", line 155, in _update > time.sleep(period) > KeyboardInterrupt > 0(37001) ALERT: <core> [main.c:774]: handle_sigs(): child process > 37002 exited normally, status=1 > 0(37001) INFO: <core> [main.c:802]: handle_sigs(): terminating due to > SIGCHLD > 1(37003) ERROR: <core> [core/udp_server.c:464]: udp_rcv_loop(): > recvfrom:[4] Interrupted system call > 8(37014) CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 4 > 1(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
__________________________________________________________ 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