The swoole process child process fatal, the parent process can not listen to the SIGCHLD signal?

Use process multiprocess in

cli mode. The
master process exits and restarts the child process through the SIGCHLD listening child process.


    swoole_process::signal(SIGCHLD, function(){
        // 
        while ($ret = swoole_process::wait(false)) {
            unset(self::$wokers[$ret["pid"]]);
            self::logError("SIGNAL-WORKER_EXIT-%s", $ret["pid"]);
            //
            self::initProcess();
        }
    });

directly kill the child process, and the parent process can receive the signal and pull the child process again.

when fatal occurs in the child process, the parent process does not receive the signal that the child process exits, and the child process becomes a zombie process.

[php] <defunct>

would like to ask all the bosses have encountered this kind of situation? When pcntl is implemented, when the child process fatal, the parent process is subject to SIGCHLD.

Jun.26,2022

the main reason for this situation may be that there is a problem with your parent process logic. swoole_process::signal is asynchronous signal processing, and your program is completely asynchronous and non-blocking. If your parent process code is while (true) endless loop, synchronous blocking, there is no chance to execute it.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e84ab2-68464.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e84ab2-68464.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?