Page 1 of 2

Magick and Rackspace Cloud

Posted: 2013-07-10T19:20:21-07:00
by rattlehead
The fact that I am consulting the the Image::Magick forum while an active support ticket is open on Rackspace Cloud should indicate how close to my wit's end I am. I've spent 25+ hours on this issue this week alone. If I can't solve this problem in a few days, I'll have to move one - if not several - sites from their servers.

We've been using the perl module Image::Magick for all of our image processing for several years now. Both on web servers, and local servers. For some reason, one of our scripts on a site hosted by Rackspace has just simply stopped working. (I haven't even tried any of the other sites we host with them yet, as this site is the priority.) There's no error, no entry in the cgi log, it just bails after 20secs and returns an empty page.The product galleries are full of hundreds of thumbnails from the past 6 months. The last successful run appears to be on 5/7/2013. No one at Rackspace seems to have any idea what is wrong.

Do any of you know of any issues with Rackspace in particular? And, in lieu of that - any suggestions on a better host that is more Majick-friendly?

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T20:19:46-07:00
by fmw42
I know little about Perlmagick. But have you considered there may have been some changes in environment at your ISP? Might they have changed or added another versions of IM. Might some of the delegates have been updated. For the developers who might know more about Perlmagick, perhaps you should post your script that fails so others can test it against an image that fails for you.

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T20:35:58-07:00
by rattlehead
I'm fairly certain the environment must've changed somehow... the script has been running flawlessly for over a year. But they don't seem to have any clue what it is. They claim the magick version hasn't been touched in several months.

I appreciate the offer about the script, but it's a fairly complex series of proprietary interlocking scripts. Probably a total of 10,000 lines. Posting them would not only not help, they would probably confuse the situation even more.

That's how desperate I am... I'm literally asking anyone here, "hey, anyone know about any rackspace cloud issues?"

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T21:41:42-07:00
by fmw42
if the imagemagick version has not changed, what about the delegates that it might be using? Perhaps one of them was updated for another reason and it might have an effect on your script? Does your script require any special delegate? Does it work for all input and output image types? Does it work for any image type? Have any permissions been changed on any directories involved? Is the /tmp directory overloaded? Has your memory or disk configuration been changed. Lots to potentially ask your ISP.

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T22:30:29-07:00
by rattlehead
There's really nothing special about the Image::Magick portions of the script. It's all pretty boilerplate. We use the same scripts both locally on ubuntu boxes, and have used them successfully on several other sites, across different hosts. As far as I know, it works for all images types... but we've only used it with .jpgs. I also went back and swapped out the images, hoping it was just a corrupted image file or something. Checked permissions, too... set them wide open.

These are cloud servers, so I'm not exactly sure where the /tmp directory would even be. As far as I know, this is only affecting this site. I am *assuming* that if it was a /tmp sort of problem, it would affect anyone else using Image::Magick. And being cloud servers, the memory or disk configuration wouldn't really come into play.

Thank you for working through this with me. Any other ideas I haven't tried, keep 'em coming.

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T22:32:53-07:00
by fmw42
Just curious, has it ever worked on this cloud server?

Is it possible that the script file is corrupt? Might it be using wrong line endings for the server type presumably Linux?

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T22:39:00-07:00
by rattlehead
Yep, it worked fine for over a year on this server, for this site. Flawlessly. In fact the thumbnails directory is full of hundreds of images created by the script and image::magick over that time... the newest timestamp was 5/7/2013; which was the last major update on the site.

In fact, I've *fixed* it by bypassing the thumbnail creation altogether and doing it manually and ftping it up. Sucks.

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T22:41:07-07:00
by fmw42
rattlehead wrote:Yep, it worked fine for over a year on this server, for this site. Flawlessly. In fact the thumbnails directory is full of hundreds of images created by the script and image::magick over that time... the newest timestamp was 5/7/2013; which was the last major update on the site.
It kind of points to the update -- something is different, such as the IM version or the delegates.

Perhaps Magick will have some better ideas in the morning.

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T22:45:41-07:00
by fmw42
In fact, I've *fixed* it by bypassing the thumbnail creation altogether and doing it manually and ftping it up. Sucks.
Can you outline the functionality of the script so we have some idea of what commands are being used, so we can see if any particular delegates are being used? Also it would help to know the IM version being used. There may be a bug in one of the commands you are using in that version.

If you are using jpg, you need the jpg delegate. Sometimes two different delegates are loaded by different programs. That can cause a problem with IM.

Have you tried writing output images at various stages of your script to try to figure out where it dies? That would be the perlmagick equivalent of -write tmpimage in command line. Or print out messages at various stages of your script to know it got that far?

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T22:46:55-07:00
by rattlehead
You misunderstand my use of the word "update". Rackspace hosts the site... they claim the magick version hasn't been updated in 9 months or so.

When I say update, I mean my update to the client's site with new products. That was the last time the script worked properly. She's a fashion wholesaler, she tends to update her product listings roughly quarterly.

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T22:52:47-07:00
by rattlehead
All it does is this:

1) unpack the zip file containing new product images
2) move the master images to the store's master image directory
3) create thumbnails of various sizes and deposit them into subdirectories in the master
4) create a new, empty product record
5) refresh entire site

I basically bypassed #3, and I upload the thumbnails myself. It works fine.

I've thoroughly dissected the process, and can confirm it breaks down after #2. In fact, the very first image in the zip file gets moved to the master directory ok... it bail during the thumbnail creation. All that gets returned is blank page. No errors in the log. Nothing in the stacktraces. If you're really a glutton for punishment, here is the relevant subroutine that creates the thumbnails, with my bypass now in place:

Code: Select all

#sub matrixImage([imagefile], [output path], [\@sizes], $wmode);
sub matrixImage
{
	my($file, $mpath, $mref, $wmode)=@_;	
	my($fname)=substr($file, rindex($file, "/")+1);
	my(@mtx)=@{$mref};
	
	return(1);	#we are bypassing matrixing because we still can't solve the rackspace issue
	
	my($p)=new Image::Magick;
	
	$p->Read($file);
	$p->Resample(density=>'150x150');		#this is fixed at 150 for now
	
	#check to see if subdirs are there
	foreach(@mtx)
	{
		unless(-e "$mpath/$_")
		{	mkdir("$mpath/$_");}
	}	

	foreach(@mtx)
	{
		if((-e "$mpath/$_/$fname") and ($wmode ne "overwrite"))
		{	next;}
		
		$p->Resize(geometry=>$_."x".$_);	
		$p->Write(filename=>"$mpath/$_/$fname", compression=>'JPEG');	#also fixed to jpg
	}	
	
	undef $p;
	
	return(1);
}

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T22:53:08-07:00
by fmw42
OK. But nevertheless, you can try to track down where it breaks by sending messages back from various places in the script. That might pin it down to one IM command. Also try to copy the text and paste into a new text file for your script to be sure there are no file issues.

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T22:55:02-07:00
by rattlehead
Rackspace confirms that the Image::Magic module is present, functioning, and at version 6.2.8

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T22:56:54-07:00
by fmw42
I've thoroughly dissected the process, and can confirm it breaks down after #2. In fact, the very first image in the zip file gets moved to the master directory ok... it bail during the thumbnail creation
So it could be the thumbnail creation or the moving to the subdirectory?

Have you tried just processing thumbnails with a set of images in a new script or by command line?

Re: Magick and Rackspace Cloud

Posted: 2013-07-10T22:59:33-07:00
by rattlehead
you can try to track down where it breaks by sending messages back from various places in the script.
Yep, I did all that. If I let the script go past that return, it crashes as soon as it hits the my($p)=new Image::Magick;

I can verify that all the values getting passed in and out are correct and still present. It simply works. Until I call image::magick... then it just vanishes.

(and yes, I do load the required module in the BEGIN block.)

It's definitely the thumbnail creation. As I said, as it stands right now - with the Image::Magick bypassed as in the code example above - it works fine. All images are moved properly. All records are created. It's just that now I have to make the thumbnails manually and upload them.