完成Java进程的锁定

时间:2012-04-03 11:42:54

标签: java lockup

这个令人费解。突然之间,我们开始遇到Java进程中的所有线程都达到BLOCKED状态并且进程完全冻结的情况。没有jvm.log或hs * .log文件指向正在发生的事情。

jstack转储列出了许多线程,所有线程都处于BLOCKED状态,其中一些线程令人困惑:

Thread 14766: (state = BLOCKED)
- java.lang.String.substring(int, int) @bci=62, line=1939 (Compiled frame)
- java.util.Formatter.parse(java.lang.String) @bci=73, line=2469 (Compiled frame)
- java.util.Formatter.format(java.util.Locale, java.lang.String, java.lang.Object[]) @bci=213, line=2438 (Compiled frame)
- java.util.Formatter.format(java.lang.String, java.lang.Object[]) @bci=7, line=2367 (Compiled frame)
- java.lang.String.format(java.lang.String, java.lang.Object[]) @bci=9, line=2769 (Compiled frame)

(裁剪其余部分)

或者这个:

Thread 14794: (state = BLOCKED)
- java.lang.Throwable.toString() @bci=17, line=344 (Interpreted frame)
- java.lang.String.valueOf(java.lang.Object) @bci=10, line=2826 (Compiled frame)
- java.io.PrintWriter.println(java.lang.Object) @bci=1, line=710 (Interpreted frame)
- java.lang.Throwable.printStackTrace(java.io.PrintWriter) @bci=6, line=509 (Compiled frame)
- org.apache.log4j.DefaultThrowableRenderer.render(java.lang.Throwable) @bci=19, line=60 (Compiled frame)
- org.apache.log4j.spi.ThrowableInformation.getThrowableStrRep() @bci=50, line=87 (Interpreted frame)
- org.apache.log4j.spi.LoggingEvent.getThrowableStrRep() @bci=13, line=413 (Compiled frame)
- org.apache.log4j.WriterAppender.subAppend(org.apache.log4j.spi.LoggingEvent) @bci=26, line=313 (Compiled frame)
- org.apache.log4j.RollingFileAppender.subAppend(org.apache.log4j.spi.LoggingEvent) @bci=2, line=276 (Interpreted frame)
- org.apache.log4j.WriterAppender.append(org.apache.log4j.spi.LoggingEvent) @bci=10, line=162 (Compiled frame)
- org.apache.log4j.AppenderSkeleton.doAppend(org.apache.log4j.spi.LoggingEvent) @bci=106, line=251 (Compiled frame)
- org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(org.apache.log4j.spi.LoggingEvent) @bci=41, line=66 (Compiled frame)
- org.apache.log4j.Category.callAppenders(org.apache.log4j.spi.LoggingEvent) @bci=26, line=206 (Compiled frame)
- org.apache.log4j.Category.forcedLog(java.lang.String, org.apache.log4j.Priority, java.lang.Object, java.lang.Throwable) @bci=14, line=391 (Interpreted frame)
- org.apache.log4j.Category.error(java.lang.Object, java.lang.Throwable) @bci=37, line=322 (Interpreted frame)

(裁剪其余部分)

我必须承认,虽然我试图在线搜索原因,但我不知道从哪里开始寻找它。

这发生在jdk1.6.0_31

4 个答案:

答案 0 :(得分:3)

它们在字符串操作中都被阻止了吗?您是否已经用尽堆perm gen空间(在挂起的进程上执行'jstat -gc')

答案 1 :(得分:0)

什么是操作系统?多线程问题很多时候都依赖于OS,因为它们的实现是特定于操作系统的。 Java线程只是操作系统线程的抽象。

/高野

答案 2 :(得分:0)

我会用-verbosegc运行程序。它似乎被阻塞等待一些空闲空间。

答案 3 :(得分:0)

这部分例外:

org.apache.log4j.Category.callAppenders(org.apache.log4j.spi.LoggingEvent) @bci=26, line=206 (Compiled frame)
org.apache.log4j.Category.forcedLog(java.lang.String, org.apache.log4j.Priority, java.lang.Object, java.lang.Throwable) @bci=14, line=391 (Interpreted frame)
org.apache.log4j.Category.error(java.lang.Object, java.lang.Throwable) @bci=37, line=322 (Interpreted frame)

可能与log4j中的错误有关。请查看以下网页:

https://issues.apache.org/bugzilla/show_bug.cgi?id=41214