Bug #79755 [Opn->Fbk]: Php process might hang on fatal error if proc from proc_open is not closed
| From: | cmb@php.net | Date: | Tue, 30 Jun 2020 10:50:24 +0000 |
| Subject: | Bug #79755 [Opn->Fbk]: Php process might hang on fatal error if proc from proc_open is not closed | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-227738@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79755&edit=1
ID: 79755
Updated by: cmb@php.net
Reported by: michael dot vorisek at email dot cz
Summary: Php process might hang on fatal error if proc from
proc_open is not closed
-Status: Open
+Status: Feedback
Type: Bug
Package: Scripting Engine problem
Operating System: Windows
PHP Version: 7.4.7
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Well, without more detailed information this is unlikely
to be actionable. I mean there are certainly ways to
cause a the parent process to hang, which would not be a bug
in PHP, but rather in the userland script, e.g.
<?php
$descs = [['pipe', 'r'], ['pipe', 'w'], ['pipe',
'w']];
$proc = proc_open('php -r "echo str_repeat(\'*\', 10000);"', $descs,
$pipes);
set_error_handler(function () use ($pipes) {
fwrite($pipes[0], str_repeat('*', 10000));
});
trigger_error('error', E_USER_ERROR);
?>
The point is that anonymous pipes are always blocking on Windows,
what manifests if there is more data in the pipe than the pipe
manager is able to buffer[1].
[1] <https://devblogs.microsoft.com/oldnewthing/20110707-00/?p=10223>
Previous Comments:
------------------------------------------------------------------------
[2020-06-28 13:57:51] michael dot vorisek at email dot cz
Description:
------------
reproducible with quote complex code on Windows platform with PHP 7.4.7 NTS
issue has gone if processes were stopped properly in the script before a fatal error is thrown
php code needs to be checked, it seems, that after a fatal error not all child processes are
terminated properly
Test script:
---------------
// start several processes with proc_open and keep them running
// now throw some fatal error like with class with invalid method signature
// notice, that PHP process will not finish
Expected result:
----------------
php process finishes and there are no child processes left
Actual result:
--------------
php process hang
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79755&edit=1