php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61785 Memory leak when access a non-exists file without router
Submitted: 2012-04-20 09:36 UTC Modified: 2012-04-20 16:06 UTC
From: reeze dot xia at gmail dot com Assigned: laruence (profile)
Status: Closed Package: Built-in web server
PHP Version: 5.4.0 OS: ANY
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: reeze dot xia at gmail dot com
New email:
PHP Version: OS:

 

 [2012-04-20 09:36 UTC] reeze dot xia at gmail dot com
Description:
------------
When access a non exists file in builtin web server. with --enable-debug it report 
leaks. 

When send error page, It call php_output_deactivate() it disabled the sent_headers 
callback but it will emalloc default_content-type. then it leaks.

So I think set SG(sapi_headers).send_default_content_type to 0 temporary can avoid 
leaking.

Test script:
---------------
NONE

Expected result:
----------------
no leaks

Actual result:
--------------
PHP 5.4.1RC1-dev Development Server started at Fri Apr 20 17:23:52 2012
Listening on localhost:9999
Document root is /Users/reeze/Opensource/php-src
Press Ctrl-C to quit.
[Fri Apr 20 17:24:05 2012] ::1:56664 [404]: /no-exist.png - No such file or 
directory
[Fri Apr 20 17:24:05 2012] ::1:56665 [404]: /favicon.ico - No such file or 
directory
^C[Fri Apr 20 17:24:07 2012]  Script:  '-'
/Users/reeze/Opensource/php-src/main/SAPI.c(839) :  Freeing 0x10A6B0208 (24 
bytes), script=-
[Fri Apr 20 17:24:07 2012]  Script:  '-'
/Users/reeze/Opensource/php-src/Zend/zend_llist.c(39) :  Freeing 0x10A6B04A8 (39 
bytes), script=-
[Fri Apr 20 17:24:07 2012]  Script:  '-'
/Users/reeze/Opensource/php-src/main/SAPI.c(321) :  Freeing 0x10A6B4758 (10 
bytes), script=-
=== Total 3 memory leaks detected ===

Patches

Fixed-typo-in-test-php_cli_server_016 (last revision 2012-04-20 09:52 UTC by reeze dot xia at gmail dot com)
0001-Bug-61785-Memory-leak-when-access-a-non-exists-file-.patch (last revision 2012-04-20 09:50 UTC by reeze dot xia at gmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-20 09:53 UTC] reeze dot xia at gmail dot com
Hi, 
   I've attached a patch for this. and I fixe a typo in similar mem leak fix's 
test.

@see https://github.com/php/php-src/pull/64

Thanks.
 [2012-04-20 16:06 UTC] laruence@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

fixed in : http://git.php.net/?p=php-
src.git;a=commit;h=cc58373d4d9b0b3d8b0e2cbf86dfee37da799c77
 [2012-04-20 16:06 UTC] laruence@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 02:01:27 2024 UTC