Wednesday, July 14, 2010

Oracle JVM 6u21 and Eclipse

A number of users have encountered frequent Eclipse crashes since the recent Oracle JVM 6u21 update. The crash cause is listed as follows:

java.lang.OutOfMemoryError: PermGen space

The underlying problem if that in 6u21 (version 1.6.0_21), the vendor was changed from Sun to Oracle. Eclipse launcher reads the JVM vendor and if it detects a Sun JVM, it adds an extra –XX:MaxPermSize setting that is necessary for Eclipse to function. With the vendor change in 6u21, the launcher is no longer adding the necessary parameter on launch.

There is an Eclipse Platform bug open, but so far it doesn't look like there is going to be an attempt to resolve this until Helios SR1 scheduled for September.

Remove it. In it's place, add -XX:MaxPermSize=256m on a new line after the -Xmx setting. Better yet, while you are in there, bump the memory limits to a higher value. Nothing ruins your train of thought better than your IDE crashing with an OutOfMemoryError. Here is a sample eclipse.ini that works on 6u21.

IMPORTANT: I do work for Oracle, but this is not an official Oracle statement on this issue. Just some advice from one Eclipse developer to another.

Update: This problem is specific to Windows. On *nix variants, Eclipse launcher uses slower, but more robust logic for detecting JVM type. More information in Bug 320005 for those who are interested.

Update: Oracle has produced another build of 6u21 JVM that reverts the change that adversely affected Eclipse. If you have reverted back to an older JVM, you can safely move forward to 6u21. The build 1.6.0_21-b07 is safe to use. The version that Eclipse has trouble with is b06. You can check which version you have by running "java -version". More information in Sun Bug 6969236 for those who are interested.

Thanks for that Info, although I knew that stuff before, because I run into that problem. Oracle should NOT do such changes in a minor release, wondering how they could do something like that: they should backport quickly.

I heard / read that this only impacts on Win-Platforms, is that true? And if yes: why?

I am not sure who's problem this is. I hope this isn't a communication problem with the Eclipse team and Oracle. You would have thought that a simple (I am assuming a simple change) change such as this would have been communicated between the Eclipse team and Oracle. It's not as if Eclipse is a small IDE. The majority of Java developers have used and continue to use Eclipse at some point. Doesn't Oracle have an Eclipse plugin, Oracle Enterprise Pack for Eclipse, for development. Didn't they notice that Eclipse was crashing? Something's not adding up...