#42545 [NEW]: Resource descriptors leaks

From: Date: Tue, 04 Sep 2007 16:56:42 +0000
Subject: #42545 [NEW]: Resource descriptors leaks
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-117116@lists.php.net to get a copy of this message
From: netclone at bigmir dot net Operating system: Windows XP SP2 PHP version: 5.2.4 PHP Bug Type: Reproducible crash Bug description: Resource descriptors leaks Description: ------------ System halts, php hangs up - each file-resource handler becomes invalid. I'm using CLI php.exe to process image storage with JPG files with approximately size 2-3Mb each. Script uses database dump file each line of them points to physical file location. This dump has 4000-6000 records. Within cycle it reads one line from dump and call this code, and writes result into log file. It’s outputs ~180 files (~18Kb) per 3-5 sec. Crash becomes at ~ 4h of work. Looks like no more handles aviable. We have same results on 4 PC’s (all PC’s new, just bayed week ago, all systems has same configuration Core2Duo/3GHz/2Gb, firmly HP), running on Windows XP SP2 (all updates installed), installed extensions – php_oci8.dll, php_gd2. Reproduce code: --------------- $url = {image}; $FileDir = {path} //code to read IN file and open log @mkdir($FileDir, 0755, true); if( file_exists($FileDir) ) { $InputImage = @ImageCreateFromJPEG( $url ) $iw = ImageSX($InputImage); $ih = ImageSY($InputImage); $ThumbImage = @imagecreatetruecolor(124, 82)) imagecopyresampled($ThumbImage, $InputImage,0, 0, 0, 0, 124, 82, $iw, $ih); ImageJPEG($ThumbImage, $thumbnail, 80 ); ImageDestroy($ThumbImage); $rows = ceil($iw /256); $cols = ceil($ih /256); for($i = 0; $i < $rows; $i++ ) for( $j = 0; $j < $cols; $j++ ){ if ($OutputImage = @ImageCreateTrueColor( 256,256 ) { ImageCopy( $OutputImage, $InputImage, 0, 0, $x, $y, $cw, $ch ); ImageJPEG( $OutputImage, $OutputFile, 80 ); ImageDestroy($OutputImage); } ImageDestroy($InputImage); } Expected result: ---------------- images in correpsonding folders Actual result: -------------- ~4h all is ok, but at nearly 2500-2700 image it's write in log PHP Warning: imagejpeg(): Unable to open 'xxx.jpg' for writing: Invalid argument in script.php on line xx PHP Warning: fwrite(): supplied argument is not a valid stream resource PHP Warning: fclose(): supplied argument is not a valid stream resource System hangs on, you can't open or run anything and need to reboot. During this time created ~720 000 images -- Edit bug report at http://bugs.php.net/?id=42545&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42545&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42545&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42545&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42545&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42545&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42545&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42545&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42545&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42545&r=support Expected behavior: http://bugs.php.net/fix.php?id=42545&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42545&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42545&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42545&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42545&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42545&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42545&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42545&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42545&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42545&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42545&r=mysqlcfg

« previous php.bugs (#117116) next »