Bug #78919 [Asn->Csd]: CLI server does insufficient cleanup if php_request_startup() fails
| From: | git@php.net | Date: | Tue, 17 Aug 2021 10:41:49 +0000 |
| Subject: | Bug #78919 [Asn->Csd]: CLI server does insufficient cleanup if php_request_startup() fails | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-235894@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78919&edit=1
ID: 78919
Updated by: git@php.net
Reported by: cataphract@php.net
Summary: CLI server does insufficient cleanup if
php_request_startup() fails
-Status: Assigned
+Status: Closed
Type: Bug
Package: Built-in web server
Operating System: Irrelevant
PHP Version: 7.2.25
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmb69
Revision: https://github.com/php/php-src/commit/be2df43b08cf13b9a5791ff5eb827a125115ef52
Log: Fix #78919: CLI server: insufficient cleanup if request startup fails
Previous Comments:
------------------------------------------------------------------------
[2021-07-30 13:38:36] cmb@php.net
The following pull request has been associated:
Patch Name: Fix #78919: CLI server: insufficient cleanup if request startup fails
On GitHub: https://github.com/php/php-src/pull/7322
Patch: https://github.com/php/php-src/pull/7322.patch
------------------------------------------------------------------------
[2019-12-07 14:10:53] cataphract@php.net
The Apache SAPI does call shutdown after a failed startup:
https://github.com/php/php-src/blob/5d6e923d46a89fe9cd8fb6c3a6da675aa67197b4/sapi/apache2handler/sapi_apache2.c#L710
and we haven't had any crashes reported from the errors raised during RINIT in our extension
(sqreen).
FPM simply exists if there's an error during RINIT but it can be worked around easily for our
purposes.
------------------------------------------------------------------------
[2019-12-07 13:10:47] cmb@php.net
Thanks! I wonder, though, whether it is generally safe to call
php_request_shutdown() after php_request_startup() has failed.
------------------------------------------------------------------------
[2019-12-06 14:43:49] contratempo at gmail dot com
The following patch has been added/updated:
Patch Name: cli_no_exit.diff
Revision: 1575643429
URL: https://bugs.php.net/patch-display.php?bug=78919&patch=cli_no_exit.diff&revision=1575643429
------------------------------------------------------------------------
[2019-12-06 14:42:35] cataphract@php.net
Description:
------------
If php_request_startup() fails, for instance because an extension throws an error during its RINIT,
then the CLI server doesn't run php_request_shutdown().
In particular, the memory manager will not be shutdown, which means that repeatedly issuing errors
during RINIT will result in eventually PHP running out of memory.
Test script:
---------------
See https://gist.github.com/cataphract/b3d6fca0dc31132a5d190d2de7d07db3
build the image and start a container. Then hit http://localhost:8080/ After 3 or requests, the CLI server will
exit due to lack of memory.
Expected result:
----------------
The server runs continuously.
Actual result:
--------------
The server exits after a couple of requests.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78919&edit=1