php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79755 Php process might hang on fatal error if proc from proc_open is not closed
Submitted: 2020-06-28 13:57 UTC Modified: 2020-07-12 04:22 UTC
From: michael dot vorisek at email dot cz Assigned: cmb (profile)
Status: No Feedback Package: Scripting Engine problem
PHP Version: 7.4.7 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: michael dot vorisek at email dot cz
New email:
PHP Version: OS:

 

 [2020-06-28 13:57 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-06-30 10:50 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-06-30 10:50 UTC] cmb@php.net
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>
 [2020-07-12 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Aug 12 22:01:24 2020 UTC