어디서 문제가 되었나 했더니..
아파치 루씬/Solr 쪽에서 테스트하다가 문제 발견되었다.
jdk7 뿐 아니라 jdk6 에서도 영향이 있을 수 있으니. 조심히 jvm option 체크할 것!
(아래 빨강 색칠)

http://www.lucidimagination.com/blog/2011/07/28/dont-use-java-7-for-anything/


From: Uwe Schindler
Date: Thu, 28 Jul 2011 23:13:36 +0200
Subject: [WARNING] Index corruption and crashes in Apache Lucene Core / Apache Solr with Java 7

Hello Apache Lucene & Apache Solr users,
Hello users of other Java-based Apache projects,

Oracle released Java 7 today. Unfortunately it contains hotspot compiler
optimizations, which miscompile some loops. This can affect code of several
Apache projects. Sometimes JVMs only crash, but in several cases, results
calculated can be incorrect, leading to bugs in applications (see Hotspot
bugs 7070134 [1], 7044738 [2], 7068051 [3]).

Apache Lucene Core and Apache Solr are two Apache projects, which are
affected by these bugs, namely all versions released until today. Solr users
with the default configuration will have Java crashing with SIGSEGV as soon
as they start to index documents, as one affected part is the well-known
Porter stemmer (see LUCENE-3335 [4]). Other loops in Lucene may be
miscompiled, too, leading to index corruption (especially on Lucene trunk
with pulsing codec; other loops may be affected, too – LUCENE-3346 [5]).

These problems were detected only 5 days before the official Java 7 release,
so Oracle had no time to fix those bugs, affecting also many more
applications. In response to our questions, they proposed to include the
fixes into service release u2 (eventually into service release u1, see [6]).
This means you cannot use Apache Lucene/Solr with Java 7 releases before
Update 2! If you do, please don’t open bug reports, it is not the
committers’ fault! At least disable loop optimizations using the
-XX:-UseLoopPredicate JVM option to not risk index corruptions.

Please note: Also Java 6 users are affected, if they use one of those JVM
options, which are not enabled by default: -XX:+OptimizeStringConcat or
-XX:+AggressiveOpts

It is strongly recommended not to use any hotspot optimization switches in
any Java version without extensive testing!

In case you upgrade to Java 7, remember that you may have to reindex, as the
unicode version shipped with Java 7 changed and tokenization behaves
differently (e.g. lowercasing). For more information, read
JRE_VERSION_MIGRATION.txt in your distribution package!

On behalf of the Lucene project,
Uwe

[1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7070134
[2] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7044738
[3] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7068051
[4] https://issues.apache.org/jira/browse/LUCENE-3335
[5] https://issues.apache.org/jira/browse/LUCENE-3346
[6] http://s.apache.org/StQ

Posted by '김용환'
,
loop 관련 코드를 최적화하면서 for, while 문에 문제가 있다고 알려진 버그들.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7070134
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7044738
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7068051



open jdk7에서는 관련 코드(loop predicate)를 삭제를 했음
http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/c96c3eb1efae
 
해결을 위해서는 아래 옵션을 jvm에 추가해야 함.

 -XX:-UseLoopPredicate
Posted by '김용환'
,

6번째.. 마지막이다.
(오늘 jdk7 정식 릴리즈 되는날 완료했다. )

invokedynamic
fork/join
project coin
nio2
를 제외한 나머지 내용.


Posted by '김용환'
,
Posted by '김용환'
,
Posted by '김용환'
,


OSCON 2011 에서 Joe Darcy가 발표한 2개를 공유한다.
 

JDK7 nutshell 

http://blogs.oracle.com/darcy/resource/OSCON/oscon2011_JDK7_nutshell.pdf

동영상 : http://www.youtube.com/watch?v=7nkB3hxH5po&feature=player_embedded

내용 : jdk 7 기본 소개, project coin에 시간을 많이 들임 (Netbeans 사용)




OpenJDK의 State 공유

http://blogs.oracle.com/darcy/resource/OSCON/oscon2011_OpenJDKState.pdf

내용 : JDK7으로 가는 여정, JCP의 state, jdk 7 기본 소개,jdk 8 방향

Posted by '김용환'
,

java7 nio2를 소개.



Posted by '김용환'
,
Posted by '김용환'
,
Posted by '김용환'
,

출처 : 
http://blogs.sun.com/CoreJavaTechTips/entry/closing_a_urlclassloader
http://blog.sdnkorea.com/blog/770

자바의 클래스 로더의 약점은 바로 cloassloader였다. 이 녀석들이 클래스 파일을 읽어서 객체로 인스턴스화하고, null이 되어 garbagec collector에 의해서 gc되기 전까지는 이름은 같은데, 다른 인스턴스에 대해서 로딩을 할 때 문제가 생기는 문제가 있었다.

이를 해결하기 위해서는  즉 객체와 연결이 끝나게 하는 Kill 또는 Dispose, Disconnect 같은 것이 필요했는데. 다행히 이번 jdk7에서부터 추가된다고 한다. 전부 다는 아니지만. URLClassLoader에 의해서 지원한다고 하니 좋은 소식이다.
즉, URLClassLoader를 close메소드를 호출하여 null 로 하고, 또다른 URLClassLoader를 이용해서 다른 클래스 로딩을 할 수 있기 때문에. 훨씬 모듈 프로그래밍에 획기적인 개발이 되지 않을 까 싶다.

URL ClassLoader는 다음의 리소스들을 지원한다. 모듈 프로그래밍이 정말 편해지게 될 것이라 생각된다.
  • file: (loads from file-system directories)
  • jar: (loads from JAR files)
  • http: (loads from http servers)

샘플 소스가 이를 말해준다!!! 모듈 프로그래밍이 잼나겠다. 다만.. jdk을 쓰지 못하는 임베디드쪽 자바는 힘들뿐~~ 
       // foo.jar 모듈을 읽는다.
       URL url = new URL("file:foo.jar");
       URLClassLoader loader = new URLClassLoader (new URL[] {url});
       Class cl = Class.forName ("Foo", true, loader);
       Runnable foo = (Runnable) cl.newInstance();
       foo.run();
       loader.close ();

       // foo.jar gets updated somehow

       loader = new URLClassLoader (new URL[] {url});
       cl = Class.forName ("Foo", true, loader);
       foo = (Runnable) cl.newInstance();
       // run the new implementation of Foo
       foo.run();






'java core' 카테고리의 다른 글

JavaOne 2008  (0) 2009.04.17
addShutdownHook() of Runtime class  (0) 2009.04.17
JMX 에서 standardbean 사용 관련 Tip  (0) 2009.03.28
JMX를 통해서 cpu 정보 구하기  (0) 2009.03.25
Java Memory 이야기  (0) 2009.03.25
Posted by '김용환'
,