#37367 [Opn]: WNOHANG option causes no PID to be returned.
| From: | doprea@php.net | Date: | Mon, 08 May 2006 16:56:44 +0000 |
| Subject: | #37367 [Opn]: WNOHANG option causes no PID to be returned. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-96837@lists.php.net to get a copy of this message | ||
ID: 37367
User updated by: doprea@php.net
Reported By: doprea@php.net
Status: Open
Bug Type: PCNTL related
Operating System: Fedora 4
PHP Version: 5.1.4
New Comment:
(email change.)
Previous Comments:
------------------------------------------------------------------------
[2006-05-08 16:55:22] doprea@php.net
Description:
------------
Thanks in advance for helping me to resolve this issue-- It will be a
great help!!
Passing the WNOHANG option will cause pcntl_wait() and pcntl_waitpid()
to never return a PID, but only 0 or -1 (0 before a child returns, and
-1 after). I have tested this under version 5.0.4-10, 5.1.2-5, and
5.1.4, both with and without the --enable-sigchild build option.
Reproduce code:
---------------
ftp://www.redplanet5.net, user= temp@redplanet5.net, pass=
temp.
Expected result:
----------------
It will fork a child from the parent, and then a second child from the
first. If you send a TERM from the shell to the first child, it will
attempt to end the second child, and report whether or not it received
an acceptable wait() response. Just remove the WNOHANG flag and it
works flawlessly.
As written, the WNOHANG option was passed to the pcntl_wait() function,
and the program will report that "there may have been a problem with the
termination of the child."
Actual result:
--------------
If the WNOHANG option is removed, the program says that the child
exited nicely. This should be the case regardless of whether or not the
WNOHANG option was passed.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37367&edit=1