php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72760 Built-in server leaks tzcache
Submitted: 2016-08-05 09:55 UTC Modified: 2016-08-10 17:54 UTC
Votes:2
Avg. Score:2.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: nikic@php.net Assigned:
Status: Open Package: Built-in web server
PHP Version: 7.1.0beta1 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-08-05 09:55 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-05 10:45 UTC] 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-10 16:43 UTC] 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-10 17:54 UTC] nikic@php.net
@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.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Dec 16 22:01:25 2018 UTC