note 78859 added to function.pcntl-signal
| From: | anxious2006 at osu1 dot php dot net | Date: | Wed, 31 Oct 2007 05:35:20 +0000 |
| Subject: | note 78859 added to function.pcntl-signal | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131846@lists.php.net to get a copy of this message | ||
Under my setup (FreeBSD 6.2-RELEASE / PHP 5.2.4 CLI) I've noticed that when a child exits the
SIGCHLD handler in the parent is not always invoked. It seems to happen when two children exit near
simultaneously.
In this instance the child prints "EXIT" and the parent prints "SIGCHLD
received":
- EXIT
- SIGCHLD received
This works as expected, but now look what happens when three exit in quick succession:
- EXIT
- EXIT
- EXIT
- SIGCHLD received
- SIGCHLD received
Because of this quirk any code which tries to limit the maximum number of children by incrementing
on fork and decrementing on SIGCHLD will eventually end up with a single child (or no further
forks), since the "active children" count is always above the maximum. I've noticed
similar behaviour with using decrement after pcntl_wait(). Hopefully there's a workaround for
this.
----
Server IP: 203.16.234.91
Probable Submitter: 203.20.114.7
----
Manual Page -- http://www.php.net/manual/en/function.pcntl-signal.php
Edit -- https://master.php.net/note/edit/78859
Del: integrated -- https://master.php.net/note/delete/78859/integrated
Del: useless -- https://master.php.net/note/delete/78859/useless
Del: bad code -- https://master.php.net/note/delete/78859/bad+code
Del: spam -- https://master.php.net/note/delete/78859/spam
Del: non-english -- https://master.php.net/note/delete/78859/non-english
Del: in docs -- https://master.php.net/note/delete/78859/in+docs
Del: other reasons-- https://master.php.net/note/delete/78859
Reject -- https://master.php.net/note/reject/78859
Search -- https://master.php.net/manage/user-notes.php