Bug #72760 [Opn]: Built-in server leaks tzcache
Edit report at https://bugs.php.net/bug.php?id=72760&edit=1
ID: 72760
Updated by: nikic@php.net
Reported by: nikic@php.net
Summary: Built-in server leaks tzcache
Status: Open
Type: Bug
Package: Built-in web server
PHP Version: 7.1.0beta1
Block user comment: N
Private report: N
New Comment:
@ab: I'm seeing the leak if I run an "<?php\n" file (doing nothing). I just tried
a phpinfo() and indeed, in that case it does not occur. So this might be an issue specific to the
case where the script itself has no output.
Previous Comments:
------------------------------------------------------------------------
[2016-08-10 16:43:27] ab@php.net
I was debugging this through, but the behavior i see is different. When I request a simple phpinfo()
script under "php -S 127.0.0.1:8087 -t.", php_output_end() and consequently
append_essential_headers() runs before RSHUTDOWN. When a non existent script is requested, neither
RINIT nor RSHUTDOWN is run, is this the case we're talking about? Same i see in CLI and Apache.
A solution independent from ext/date is not that easy. Of course, it's possible to use the pure
C runtime, but the timezone handling is still the point.
Thanks.
------------------------------------------------------------------------
[2016-08-05 10:45:50] cmb@php.net
What about creating the date string earlier during the request,
what would be permissible according to RFC 7231, section
7.1.1.2[1]:
| In practice, the date can be generated at any time during
| message origination.
[1] <https://tools.ietf.org/html/rfc7231#section-7.1.1.2>
------------------------------------------------------------------------
[2016-08-05 09:55:35] nikic@php.net
Description:
------------
Since https://github.com/php/php-src/commit/f33c7b3e41bda272de83bcc4959b3e0b968e3124
the built-in server will leak the ext/date tzcache once per request.
Reason: The built-in server sends the response during output deactivate, which happens after
deactivate modules. As ext/date releases the tzcache in RSHUTDOWN, this means that the tzcache is
never released.
Possible resolution: Move tzcache destruction into post-deactivate. Or, if that is possible, make
the emission of the Date header independent of ext/date.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72760&edit=1
Thread (4 messages)