Bug #74685 [Opn->Fbk]: signal listion is wrong

From: Date: Thu, 01 Jun 2017 09:40:57 +0000
Subject: Bug #74685 [Opn->Fbk]: signal listion is wrong
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209334@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74685&edit=1 ID: 74685 Updated by: requinix@php.net Reported by: shan dot liu at msn dot com Summary: signal listion is wrong -Status: Open +Status: Feedback Type: Bug Package: PCNTL related Operating System: Linux PHP Version: 7.1.5 Block user comment: N Private report: N New Comment: Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. signal_pro won't fire if you kill the parent, and when you kill the child posix_getpid will return the PID of the current process (which is the parent). What do you think it should do? Previous Comments: ------------------------------------------------------------------------ [2017-06-01 09:34:55] shan dot liu at msn dot com Description: ------------ // <?php if(pcntl_fork())die(); $fp = pcntl_fork(); if (!$fp) { //child sleep(300); exit; } //parent function signal_pro($signo){ echo posix_getpid(); }; pcntl_signal(SIGTERM,'signal_pro'); declare(ticks = 1){ while (true){ $pid=pcntl_wait($status); if($pid==-1)break; } } ?> //linux shell kill parent id,not output kill child id,is output:parent id signal listen is wong??? Test script: --------------- <?php if(pcntl_fork())die(); $fp = pcntl_fork(); if (!$fp) { //child sleep(300); exit; } //parent function signal_pro($signo){ echo posix_getpid(); }; pcntl_signal(SIGTERM,'signal_pro'); declare(ticks = 1){ while (true){ $pid=pcntl_wait($status); if($pid==-1)break; } } ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74685&edit=1

« previous php.bugs (#209334) next »