Apache and Oracle warn of serious Java 7 compiler bugs

The newly released Java upgrade suffers hotspot-compiler problems that affect Lucene and Solr

Apache and Oracle warn of serious Java 7 compiler bugs

It looks like a few bugs have crashed Oracle's Java 7 release party that can wreak havoc on Apache Project applications. The news likely will come as a disappointment to fans of Java, who've waited five long years for a major update to the language.

Released just today, Java 7 includes hotspot-compiler optimizations that miscompile certain loops, potentially affecting projects such as Apache Lucene Core, Apache Solr, and possibly others, according to a warning from the Apache Project. At best, the bugs only cause JVMs to crash; in other cases, they result in miscalculations that can lead to application bugginess.

Oracle, too, is aware of the bugs, which were spotted five days before Java 7 was released; warnings are posted on the Sun Developer Network. The company has said it will fix the problems in the next service release.

The Apache Project outlined the specifics of problems users might face running Java 7. Solr users sticking with the default configuration "will see Java crashing with SIGSEGV as soon as they start to index documents, as one affected part is the well-known Porter stemmer." Other loops in Lucene may be miscompiled, too, according to Apache Project, which can lead to index corruption.

Notably, Java 6 users can also be hurt by the bugs if they use one of the JVM options that are not enabled by default, including -XX:+OptimizeStringConcat and -XX:+AggressiveOpts.

The bottom line, per Apache Project: Don't use Apache Lucene/Solr with Java 7 releases before Update 2. If you do, the group recommends that you at least disable loop optimizations using the -XX:-UseLoopPredicate JVM option to avoid the risk of index corruptions. The Apache Project strongly recommended that users avoid running any of the hotspot optimization switches in any version of Java without extensive testing.

Additionally, Apache Project advised that users who upgrade to Java 7 may need to reindex, "because the Unicode version shipped with Java 7 changed and tokenization behaves differently (e.g. lowercasing)." More information is available in the JRE_VERSION_MIGRATION.txt file that comes with the distribution package.

This story, "Apache and Oracle warn of serious Java 7 compiler bugs," was originally published at InfoWorld.com. Get the first word on what the important tech news really means with the InfoWorld Tech Watch blog. For the latest developments in business technology news, follow InfoWorld.com on Twitter.

Copyright © 2011 IDG Communications, Inc.