Bug->Doc #71804 [Opn->Csd]: proc_close does not return exit code
| From: | cmb@php.net | Date: | Wed, 29 Jun 2016 18:24:26 +0000 |
| Subject: | Bug->Doc #71804 [Opn->Csd]: proc_close does not return exit code | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-13657@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71804&edit=1
ID: 71804
Updated by: cmb@php.net
Reported by: mark at mpen dot ca
Summary: proc_close does not return exit code
-Status: Open
+Status: Closed
-Type: Bug
+Type: Documentation Problem
Package: Program Execution
Operating System: Ubuntu 14.10
PHP Version: 7.0.4
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2016-06-29 18:23:58] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=339529
Log: Fix #71804: proc_close does not return exit code
------------------------------------------------------------------------
[2016-03-22 00:00:02] mark at mpen dot ca
Oh really? I thought that was the same configuration we were running on PHP 5.6 according to our
internal documentation, but I guess not! Sorry for the dupe. I guess our PHP 5.6 install didn't
have it after all.
------------------------------------------------------------------------
[2016-03-21 21:04:16] as@php.net
I agree it should at least be documented somewhere.
By the way, this doesn't appear to be a new bug. After investigating I found many bugs
reporting the same behavior. Google query:
site:bugs.php.net "proc_close"
"--enable-sigchild"
You should file a bug with the maintainer of the PHP 7 package you used. They should recompile
without --enable-sigchild.
------------------------------------------------------------------------
[2016-03-21 16:20:20] mark at mpen dot ca
Thank you for investigating, disabling sigchild fixed it for me. I don't *think* I need
sigchild anymore (I'm not entirely sure what it does), so this should be fine for me, but
something should probably be done about this to warn others because it looks like a breaking change.
------------------------------------------------------------------------
[2016-03-20 05:43:01] as@php.net
In the PHP 7 trace, I noticed that the parent process is setting a signal handler for SIGCHLD.
(Search for "rt_sigaction(SIGCHLD".) Searching backwards from there, I was able to
reproduce the bug by recompiling with --enable-sigchild (already present in your
binary). This switch is from 15+ years ago (commit 674f4bac) and causes PHP to reap all child
processes asynchronously:
https://github.com/php/php-src/blob/PHP-7.0.4/main/main.c#L1515-L1523
proc_close also attempts to reap the child process here:
https://github.com/php/php-src/blob/PHP-7.0.4/ext/standard/proc_open.c#L228
but at that point it has already been reaped by sigchld_handler so waitpid
returns -1.
The only way I can think of fixing this is to keep track of exit statuses in
sigchld_handler and check that in proc_close if PHP_SIGCHILD
is defined. Very ugly.
Alternatively we might be able to deprecate --enable-sigchild.
For your specific case, you likely do not need --enable-sigchild, and recompiling
without it should fix your issue.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=71804
--
Edit this bug report at https://bugs.php.net/bug.php?id=71804&edit=1