The python script listens to the port and processes the incoming stream. If the information on the socket did not arrive more than the N time, then the error socket.timeout is sock.settimeout(N) function is used for this). Communication breaks are not frequent, so the program runs through the subprocess.Popen program in the handler, which sends information to another machine that the connection was interrupted.
The problem is that the processing script does not have to wait for the completion of the child program (which is what happens in principle), but it does not read the return code generated by the program. As a result, zombie processes flood the system ( Linux ).
It was decided this way - the SIGCHLD signal was simply ignored in the main process. Are there any other ways to generate / ignore / read the status of a spawned program without using signals and waiting for its completion? It is advisable to run in such a way as to release the daughter program to free floating and forget about it. The writing language of the child program is not important.
signal(SIGCHLD, SIG_IGN)? (posix) 2- do you really see a lot of zombies or just guess? (subprocess automatically collects the code of completed processes when you try to start a new one) - jfs