For a while now I've seen an odd issue with image resizing on the Mac (and then Windows as well). Sometimes when I would resize an image, it would take an extremely long time to finish. I'm not talking about expected slowness for a large image/high quality resize. I'm talking about some images take a few seconds, and others taking well over 2 minutes while my CPU went thermonuclear.
This was very hard to reproduce, although I had one image by Steven Erat that seemed to be pretty consistently 'bad' in terms of tripping up this issue.
Other people have not always been able to reproduce this. I know Jared has seen it, but I'm not sure many other people. RIAForge seemed to suffer from it for all images when doing screenshots.
So anyway, it was a very odd issue and that was hard to test. I spoke to Adobe engineering this morning and they pointed out that it was a confirmed bug in the 1.5 JDK. I switched my ColdFusion to use 1.6 and at first it didn't help. I did a quick check and saw that I was at: build 1.6.0_07-b06-153
I went to Apple's Java downloads, grabbed the latest update, and went up to 1.6.0_13. After restarting ColdFusion, the previous resize which had taken around 48 seconds went down to 800ms.
Hope this helps others.
Archived Comments
Another good reason - aside from the object instantiation bug in older versions - to keep Java 6 as up to date as possible.
Great tip Ray. I've had problems recently with cfimage and CMYK jpg's also seeing performance hits when resizing. I've also had other buggy behavior with CFImage where I can't load an image (using action="read") into a local variable because CF thinks "it's not a supported format". But when I i do action="resize" and use the same image as source, I don't get any errors. So maybe this problem will be solved as well. I'll be sure to get Java up-to-date ASAP!! Thanks Ray!
I've had these issue quite a bit. I'll be trying an update to _13 this evening. Hopefully the upgrade will get rid of these:
http://www.dansshorts.com/p...
Dan
Can anyone recommend the safest way to update the JVM on a windows machine? I'm nervous that I'll have problem when restarting the service.
@Simon,
No need to worry. The new JVM will install in a new directory so you will be able to switch back to the old one quickly if you get re-start problems. This is how I did the upgrade on Server 2003.
1. Install the latest JVM and note down the path. On my system the path is (I'm running v12):
C:/Program Files/Java/jdk1.6.0_12
2. Edit the jvm.config file (on my multiserver installed version of CF8, this is in C:\JRun4\bin
3. Find the 'java.home' line and comment out. Then add a new line for the latest JVM - mine looks like this:
#java.home=C:/JRun4/jre
java.home=C:/Program Files/Java/jdk1.6.0_12
4. Restart the JRun or Coldfusion service.
If there are any problems you'll get an error and can then simply uncomment the original java.home line and remove the new one.
The only problem I had was installing the JDK instead of the JVM.. :)
Give it a go.
@James
The new java home path needs to point to the JRE not the JDK so from your example it would be
C:\Program Files\Java\jdk1.6.0_12\jre
not
C:\Program Files\Java\jdk1.6.0_12
other than that it should work fine.
@SeanCoyne: I've made that exact same mistake in the past.
I should add - I reloaded the page a few times and the 800ms went to do around 400. So it got even quicker.
@ray
jedi make mistakes?!! :)
Most of my blog entries are based on my mistakes. Folks have this mistaken view that I'm smart. I'm not. I just blog _everything_, which includes all my mistakes. ;)
@Sean,
That path is exactly what I am using on my install and it's working fine - I took it from my jvm.config.
Wonder if my install is slightly different. Strange.
Where do you see Java 1.6.0_13 on the Apple website?
http://developer.apple.com/...
The newest update on that page is for 1.6.0_07.
@Elliot - I don't even see that. Latest I can find is this: "Java for Mac OS X 10.5, Update 1 adds Java SE 6 version 1.6.0_05 to 64-bit Intel Macs."
Not sure what to say, and I don't have the URL with me, but I do remember them saying it wasn't fully tested. So maybe it is a beta version. It's working finr for me so far.
@Ray
Are you sure it's 1.6.0_13? I don't think that exists for OS X.
Can you give us the java -version output?
I logged into my ADC account, and it's not even there.
@Rob
That's because they forgot to update the java listing page.
If you click the link in my previous post and look at the middle of the page there's info about "Java for Mac OS X 10.5 Update 2".
Here's the KB article:
http://support.apple.com/kb...
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03-196)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-77, mixed mode)
Ah, I found it.
The only way to download this is to login to http://connect.apple.com/ and then look at the Java downloads. The accounts are free in case anyone wondered.
It's a Developer Preview of Java for OS X and not officially supported or distributed yet.
Thanks for digging it up Elliott.
FYI to folks - I wouldn't normally do an unofficial JRE but as this is a developer machine, I didn't care.
I can't even get CF to start with this update installed.
05/15 11:22:12 error Could not pre-load servlet: ColdFusionStartUpServlet
[1]java.lang.UnsupportedClassVersionError: Bad version number in .class file
Followed by lots of NPEs as a result of that I think.
Are you sure CF is starting with Java 1.6 Ray? After installing that update if you don't change the symlink for /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK to point to 1.6 CF will start with 1.5 instead.
Elliott, I wonder if it is the version of CF I'm using. I'm using, um, a "special" version. One you have as well. I'm not using it on a stock 801.
@Ray,
Ooooh look at you.. Mr Fancy 'pre-release' Pants.. ;)
I'd be weary about this blog post then. Anyone who doesn't have that, um, "special" version will break their entire install.
Let me try my stock 801 though. Just to be sure.
Elliott, it's working just fine in my 801: 8,0,1,195765 That isn't "stock" though, that's 801 with the last CHF I believe.
Hmm, it seems that the usual trick of changing that symlink doesn't work anymore.
If all you do is change CurrentJDK CF will start with 1.5, but load lots of 1.6 code from the framework which is very odd, and also broken.
Once I changed 1.6 to be the preferred JVM in the Java Preferences.app it all worked fine. How odd.
Ah, that's how I did it. Don't use links very often so it didn't even occur to me.
Yeah. That didn't work way back on 10.4 to make CF use 1.5 as the JVM instead of 1.4 so I got in the habit.
Anyway, thanks for the tip about the java update, and sorry for the comment thread hijack!
Just to add to the path I specified above, even though the path in my jvm.config is set to:
C:/Program Files/Java/jdk1.6.0_12
Coldfusion administrator reports this path is being used:
C:\Program Files\Java\jdk1.6.0_12\jre
So at least on Server 2003 specifying the path *without* the JRE works fine.
I am intending to video blog the upgrade process soon to help anyone who is a little uncertain on how to perform it on Server 2003.
Will add comment when done.
i don't know why people don't check at least once every couple of months for the latest java version and install it. it's not like you can't roll back to an earlier version if things go south. upgrading your jvm should be THE first thing you do when you have problems or weird issues with cf.
on the flip side. after you've updated your jvm you can use javara to remove the previous version and free up some space.
http://raproducts.org/javar...