|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37367 WNOHANG option causes no PID to be returned.
Submitted: 2006-05-08 16:55 UTC Modified: 2006-05-25 19:45 UTC
From: doprea at chimesnet dot com Assigned:
Status: Closed Package: PCNTL related
PHP Version: 5.1.4 OS: Fedora 4
Private report: No CVE-ID: None
 [2006-05-08 16:55 UTC] doprea at chimesnet dot com
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:
---------------, user=, 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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-08 16:56 UTC]
(email change.)
 [2006-05-08 16:58 UTC] doprea at chimesnet dot com
Please use email address doprea at chimesnet dot com.
 [2006-05-08 16:59 UTC] doprea at chimesnet dot com
Sorry for the multiple posts: There is only one file at that location, called 'multitiered.php'.

Clearly, I'm losing my mind.
 [2006-05-15 21:55 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.

 [2006-05-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2006-05-25 19:45 UTC] doprea at chimesnet dot com
Stand by. This error occured on several versions of PHP overall several systems for several days, but is now working (the script I provided was uploaded right after being tested).

I have to spend more time on this. Thanks for looking, though.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 06:01:31 2024 UTC