AbstractCharsetProvider.charsetForName thread BLOCKED

最近一个项目机器突然报警,上去kill -3后发现有100多个线程blocked在AbstractCharsetProvider.charsetForName这里。放狗搜之,发现原来这个问题已经被报告给sun 的bug库了。有解决方案在openjdk上了,但是正式jdk还没有。故把这个bug记录下,方便以后的人遇到也不用google很久了。

 

https://issues.apache.org/jira/browse/TIKA-471   已经有人遇到同样的问题

 

sun bug库 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6790402

 

注意这里最重要的收获在于:

 

Please also note that the current implementation of sun.nio.cs.FastCharsetProvider.charsetForName()


uses a JVM-wide lock and is called very often (e.g. by new String(byte[] data,String encoding)).


This JVM-wide lock means that Java applications do not scale beyond 4 CPU cores.

你可能感兴趣的:(jvm,jdk,thread,Google,sun)