cfimage and ImageScaleToFit on Large Images Pegs CPU
I was working on the new profile picture feature of the registration and CFUnited 2009 website when I ran into an issue where a user uploaded a 2112 x 2816 (2MB) photo.
This seemed to cause file locking issues in cfimage which I was told were addressed by CF 8.0.1 Cumulative Hot Fix 1. I applied the hot fix and everything seemed to work, but then when I started testing with the large file again the CPU would jump to 100% and the request would never seem to finish. I tried all kinds of things, and nothing I did seemed to make a difference.
Finally I tried the “highestPerformance” interpolation and the requests started finishing hundreds of times faster. Any other interpolation algorithm seems to cause the thread to lock up.
I’ve fixed this in our code with:
<!--- CF8 will peg the CPU to 100% and this thread will seem to hang for minutes on large images if we don't choose highestPerformance. ---> <cfif getSize("kilobytes") gt 375> <cfset arguments.interpolation = "highestPerformance"> </cfif>
What’s most odd is that the issue only appears on Windows on the production server. On my Macbook I can choose a different algorithm and get a nice resize without hanging the request.
Production server is Java 1.6 u11, CF8.0.1 HF2, Windows Server 2003
Anyone have any ideas?