php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47090 Memory leak with non-debug build in stream_socket_client() when USE_ZEND_ALLOC=1
Submitted: 2009-01-13 16:26 UTC Modified: 2009-04-14 01:00 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: dominique dot fournier at grenoble dot cnrs dot fr dot Assigned:
Status: No Feedback Package: Streams related
PHP Version: 5.2.8 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dominique dot fournier at grenoble dot cnrs dot fr dot
New email:
PHP Version: OS:

 

 [2009-01-13 16:26 UTC] dominique dot fournier at grenoble dot cnrs dot fr dot
Description:
------------
When export USE_ZEND_ALLOC=1, before run the following script in CLI, there is a memory_leak.
When export USE_ZEND_ALLOC=0, the script leave on the same value.
The IP in the script is available, but the port is closed (no service available on this port).

Reproduce code:
---------------
<?
  for ($i =0 ; $i <30 ; $i++)
  {
    $fp=@stream_socket_client('tcp://127.0.0.1:800', $error, $err);
    unset ($fp);
    unset ($error);
    unset ($err);
    echo memory_get_usage()."\n";
  }
?>


Expected result:
----------------
Always the same value (in my case, when ALLOC=0, 8200)

Actual result:
--------------
49936
50016
50044
... repeat with an increment 30 times

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-14 02:28 UTC] crrodriguez at opensuse dot org
Cannot reproduce,memory usage is stable with 5_2 and 5_3.
 [2009-01-14 10:48 UTC] dominique dot fournier at grenoble dot cnrs dot fr dot
More informations :
CVS version has the problem too. BUT : when PHP is compiled with --enable-debug option, the leak disapear. Without debug, and with USE_ZEND_ALLOC=1, the problem persist.

./configure --prefix=/usr --disable-cgi --with-config-file-path=/etc/php5/cli --with-config-file-scan-dir=/etc/php5/cli/conf.d --build=i486-linux-gnu --host=i486-linux-gnu --mandir=/usr/share/man --enable-memory-limit --with-regex=php --disable-rpath --disable-static --with-pic --with-layout=GNU --with-pear=/usr/share/php --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-track-vars --enable-trans-sid --enable-bcmath --with-bz2 --enable-ctype --with-db4 --without-gdbm --with-iconv --enable-exif --enable-filepro --enable-ftp --with-gettext --enable-mbstring --with-pcre-regex=/usr --enable-shmop --enable-sockets --enable-wddx --with-libxml-dir=/usr --with-zlib --with-kerberos=/usr --with-openssl=/usr --enable-dbx --enable-soap --enable-zip --with-mime-magic=/usr/share/file/magic.mime --with-exec-dir=/usr/lib/php5/libexec --without-mm --disable-pdo --without-mysql --without-sybase-ct --without-sqlite --enable-pcntl --with-ncurses=/usr --enable-debug
OR --disable-debug
 [2009-04-06 12:57 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

And when you test new versions, UPDATE the version field to reflect the last version you could reproduce this. 

Also: minimize the configure line to the bare minimum one with which you can still reproduce this, disable ALL shared extensions, etc. The line you showed above contains stuff that hasn't existed for years..
 [2009-04-14 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Nov 25 20:01:23 2020 UTC