php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61030 Memory leak when using ssl_verifPeer true
Submitted: 2012-02-09 16:47 UTC Modified: 2012-11-15 06:05 UTC
Votes:10
Avg. Score:4.4 ± 0.9
Reproduced:9 of 9 (100.0%)
Same Version:4 (44.4%)
Same OS:2 (22.2%)
From: avk at keystoneinsights dot com Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.3.10 OS: fedora 14
Private report: No CVE-ID: None
 [2012-02-09 16:47 UTC] avk at keystoneinsights dot com
Description:
------------
PHP 5.3.10 (cli) (built: Feb  4 2012 08:56:48) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.1.3, Copyright (c) 2002-2012, by Derick Rethans


libcurl-7.24.0-1.0.cf.fc14.i686
nss-3.12.10-7.fc14.i686
openssl-1.0.0e-1.fc14.i686

Test script:
---------------
#! /usr/bin/env php
<?php class httpsTest{
    function curlHttps($memLeak=false){
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, 'https://sqs.us-east-1.amazonaws.com');
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $memLeak);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_exec($curl);
        curl_close($curl);
    }
}
gc_enable();
$myPid = getmypid();$i=0;
$test  = new httpsTest();
while ($test){
    $test->curlHttps(true);
    echo $i++ ." PHP Info MemUsage: ".memory_get_usage() ."    Linux Info ";
    system('cat /proc/' .$myPid .'/status|grep '.'"VmSize"');
    sleep(1);
}

Expected result:
----------------
The memory usage for PHP and Linux VMSize should stay level over time, which is 
the case when $test->curlHttps(false); is used

Actual result:
--------------
The php memory usage is level but the Linux process memory usage is growing with 
132K bytes per 18 iterations.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-15 06:04 UTC] pierrick@php.net
Do not file bugs when you have Zend extensions (zend_extension=)
loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache,
APC, Xdebug and ionCube loader.  These extensions often modify engine
behavior which is not related to PHP itself.

I tried with Xdebug and my memory increased but not with Xdebug disabled.
 [2012-11-15 06:04 UTC] pierrick@php.net
-Status: Open +Status: Feedback
 [2012-11-15 06:05 UTC] pierrick@php.net
Do not file bugs when you have Zend extensions (zend_extension=)
loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache,
APC, Xdebug and ionCube loader.  These extensions often modify engine
behavior which is not related to PHP itself.

I tried with Xdebug and my memory increased but not with Xdebug disabled.
 [2012-11-15 06:05 UTC] pierrick@php.net
-Status: Feedback +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC