php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55115 Large segment of memory still reachable with more than one request
Submitted: 2011-07-03 00:32 UTC Modified: 2011-07-22 02:28 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: arpad@php.net Assigned: moriyoshi (profile)
Status: Not a bug Package: Built-in web server
PHP Version: 5.4SVN-2011-07-03 (SVN) OS: Ubuntu
Private report: No CVE-ID: None
 [2011-07-03 00:32 UTC] arpad@php.net
Description:
------------
When using the CLI server, more than one access results in a huge amount of still reachable memory.

Test script:
---------------
touch t.php
valgrind --leak-check=full --show-reachable=yes php -S localhost:8080
[browser] /t.php
[browser] /t.php
<ctrl+c>

Actual result:
--------------
55k lines of segments that are apparently still reachable

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-03 09:24 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: moriyoshi
 [2011-07-06 16:13 UTC] sixd@php.net
If use the RFC routing example, starting the server as "php -S localhost:8000 
routing.php" and browse for an existing JPG files, I see:

PHP Development Server is listening on localhost:8000 in 
/home/cjones/public_html ... Press Ctrl-C to quit.
[Wed Jul  6 13:09:58 2011] ::1:39867: /oraclelogo.jpg
[Wed Jul  6 13:09:58 2011]  Script:  '/home/cjones/public_html/oraclelogo.jpg'
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/main/output.c(802) :  Freeing 
0xB4F53250 (48 bytes), script=/home/cjones/public_html/oraclelogo.jpg
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/Zend/zend_alloc.c(2529) : 
Actual location (location was relayed)
[Wed Jul  6 13:09:58 2011]  Script:  '/home/cjones/public_html/oraclelogo.jpg'
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/main/output.c(803) :  Freeing 
0xB4F532AC (23 bytes), script=/home/cjones/public_html/oraclelogo.jpg
[Wed Jul  6 13:09:58 2011]  Script:  '/home/cjones/public_html/oraclelogo.jpg'
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/main/output.c(808) :  Freeing 
0xB4F532F0 (8192 bytes), script=/home/cjones/public_html/oraclelogo.jpg
[Wed Jul  6 13:09:58 2011]  Script:  '/home/cjones/public_html/oraclelogo.jpg'
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/Zend/zend_stack.c(37) :  
Freeing 0xB4F5531C (256 bytes), script=/home/cjones/public_html/oraclelogo.jpg
[Wed Jul  6 13:09:58 2011]  Script:  '/home/cjones/public_html/oraclelogo.jpg'
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/Zend/zend_stack.c(42) :  
Freeing 0xB4F55448 (4 bytes), script=/home/cjones/public_html/oraclelogo.jpg
=== Total 5 memory leaks detected ===
[Wed Jul  6 13:09:59 2011] ::1:39868: /favicon.ico

If I repeat this with valgrind, I see the same output.  After ^C, I get 5.5K 
loss records reported by valgrind.
 [2011-07-22 02:28 UTC] moriyoshi@php.net
-Status: Assigned +Status: Bogus
 [2011-07-22 02:28 UTC] moriyoshi@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This seems to be caused by the Valgrind's strange behavior.  Valgrind terminates 
the program immediately when the signal was sent during a interruptible system 
call.  It eventually fails to call necessary shutdown functions, and results in 
massive leaks.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed May 22 11:01:26 2019 UTC