php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42545 It's WINDOWS-bug
Submitted: 2007-09-04 16:56 UTC Modified: 2007-09-06 10:46 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: netclone at bigmir dot net Assigned:
Status: Not a bug Package: GD related
PHP Version: 5.2.4 OS: Windows XP SP2
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: netclone at bigmir dot net
New email:
PHP Version: OS:

 

 [2007-09-04 16:56 UTC] netclone at bigmir dot net
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-05 10:03 UTC] netclone at bigmir dot net
I can see in performance monitor that PTE is slowly goes down
 [2007-09-05 20:48 UTC] netclone at bigmir dot net
crash after 50 min
<?php
$path = '.\\test_dir';
if (isset($argv[1])){$max=$argv[1]} else $max=1000000;
while ($max) 
{ $cwd = $path.DIRECTORY_SEPARATOR.$max;
  $res = @mkdir($cwd,0777,true);
  if ($res)
  {	//create here 200 empty JPG 256x256
  	for ($i=0;$i<250;$i++){
  	 if ($imp = @imagecreatetruecolor(256,256)){
  	 $file_name = $cwd.DIRECTORY_SEPARATOR."testimg$i.jpg";
  	 imagejpeg($imp,$file_name,80);
  	 imagedestroy($imp);
  	 }							
  	}
  }; $max--;	
}
?>
 [2007-09-06 09:20 UTC] netclone at bigmir dot net
This is not php bug, cause following command gives same result
for /L %i in (1,1,9000000) do md t%i
 [2007-09-06 10:46 UTC] jani@php.net
Not PHP bug -> bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 15 22:01:32 2024 UTC