#33127 [NEW]: fsockopen memory leak

From: Date: Tue, 24 May 2005 14:43:22 +0000
Subject: #33127 [NEW]: fsockopen memory leak
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-79444@lists.php.net to get a copy of this message
From: joropito at ciudad dot com dot ar Operating system: FreeBSD 5.3/4 PHP version: 5.0.4 PHP Bug Type: Sockets related Bug description: fsockopen memory leak Description: ------------ I see that fsockopen() causes a memory leak although of closing filedescriptor. Reproduce code: --------------- system("/bin/ps -maxwvj -p ".posix_getpid()); $fd = fsockopen("www.yahoo.com", 80, $errno, $errstr, 3); system("/bin/ps -maxwvj -p ".posix_getpid()); if($fd) { $out = "GET / HTTP/1.1\nHost: www.yahoo.comConnection: Close\n\n"; fwrite($fd, $out); $line = ""; while (!feof ($fd)) { $lastline = fgets($fd); $line .= $lastline; if(ereg("Content-Type: text/html", $lastline)) { break; } } fclose($fd); echo $line; } system("/bin/ps -maxwvj -p ".posix_getpid()); sleep(5); Expected result: ---------------- You will see after issue fsockopen() memory usage rises, and if you issue fclose() does not free memory. -- Edit bug report at http://bugs.php.net/?id=33127&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33127&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33127&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33127&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33127&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33127&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33127&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33127&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33127&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33127&r=support Expected behavior: http://bugs.php.net/fix.php?id=33127&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33127&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33127&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33127&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33127&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33127&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33127&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33127&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33127&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33127&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33127&r=mysqlcfg

« previous php.bugs (#79444) next »