php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31408 memory leak in stream_socket_recvfrom()
Submitted: 2005-01-04 15:35 UTC Modified: 2005-01-04 16:32 UTC
From: php at bust dot ac Assigned: wez (profile)
Status: Closed Package: Reproducible crash
PHP Version: 5.0.3 OS: RedHat 9
Private report: No CVE-ID: None
 [2005-01-04 15:35 UTC] php at bust dot ac
Description:
------------
using the stream_socket_recvfrom function in php 5.0.3 seems to leak memory.

my php is running with php.ini-recommended with the only changes being
report_zend_debug = on
display_errors = on

=== output of php -i ===
PHP Version => 5.0.3

System => Linux *************** 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686
Build Date => Jan  4 2005 13:46:18
Configure Command =>  './configure' '--with-apxs2=/usr/sbin/apxs' '--enable-sockets' '--with-mysql' '--with-mhash' '--with-dom' '--enable-memory-limit' '--enable-debug'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/Zend/etc/php.ini
PHP API => 20031224
PHP Extension => 20041030
Zend Extension => 220040412
Debug Build => yes
Thread Safety => disabled
IPv6 Support => enabled
Registered PHP Streams => php, file, http, ftp
Registered Stream Socket Transports => tcp, udp, unix, udg



Reproduce code:
---------------
<?php
        $sp = stream_socket_client( 'tcp://www.google.com:80',$null, $null2, 30);
        stream_set_blocking($sp, false);
        while (true){
                $gtCheck = stream_socket_recvfrom($sp, 1500);
                echo 'loop = '.$count++."\n";
        }
?>


Expected result:
----------------
script should run forever

Actual result:
--------------
=== end of script output ===
loop = 5551

Fatal error: Allowed memory size of 8388608 bytes exhausted at /usr/src/php-5.0.3/ext/standard/streamsfuncs.c:330 (tried to allocate 1501 bytes) in /root/test.php on line 5
Allowed memory size of 8388608 bytes exhausted at /usr/src/php-5.0.3/Zend/zend_stack.c:28 (tried to allocate 256 bytes)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-04 16:25 UTC] derick@php.net
I could verify this one...
 [2005-01-04 16:32 UTC] wez@php.net
This bug has been fixed in CVS.

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/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 05:01:30 2024 UTC