对象没有被定稿,Finalizer线程没有做任何事情 [英] Objects not being finalized and Finalizer thread not doing anything

查看:121
本文介绍了对象没有被定稿,Finalizer线程没有做任何事情的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的服务器上,我们开始遇到 OutOfMemoryError 的问题。我们使用Eclipse Memory Analysis分析了堆转储,并发现许多对象都是为了完成而定义的(约2/3的堆):



我们发现,它可能会有一些最终确定()方法阻塞。我发现了这个问题的几个错误报告( here 或<这里),并且它总是在Finalizer线程堆栈中表现出来,它在某个地方被封锁了。但在我们的例子中,这个线程正在等待:

 Finalizer守护进程prio = 10 tid = 0x43e1e000 nid = 0x3ff在Object中。等待()[0x43dfe000] 
java.lang.Thread.State:WAITING(在对象监视器上)$ b $在java.lang.Object.wait(本地方法)
- 等待< 0x4fe053e8> ; (java.lang.ref.ReferenceQueue $ Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:133)
- locked< 0x4fe053e8> (java.lang.ref.ReferenceQueue $ Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:149)
at java.lang.ref.Finalizer $ FinalizerThread.run(编辑:

$ b $
$ b

然后我们尝试添加 -XX:+ UseConcMarkSweepGC ,但没有成功,只有 OutOfMemoryError s减少了,所以我们首先认为它有帮助。

最后,我们怀疑JVM的bug,并从OpenJDK 1.6.0_30升级到Oracle JDK 1.7。 0_51,并且问题消失了(至少看起来如此,在过去的4个小时内使用的堆不会增长)。我们不记得定稿方法有什么变化,我们也没有升级任何图书馆,在那段时间只有小的发展。这个问题并没有在我们的测试服务器上重现,除了它是64位JVM,而生产服务器是32位以外,具有相同的配置。



问题是:可能是什么原因对于未定型的对象和 Finalizer 等待下一个对象的线程?我们是否正确地分析了堆转储?



感谢您的所有答复。

解决方案

我们认为它与OpenJDK 1.6.0_30版本有关。升级到Oracle JDK 1.7.0_51后,问题消失了。它可能出现在openJDK自动更新后,但我们无法证实这一点。我们找不到相关的错误报告。


On our server, we started to have problems with OutOfMemoryError. We analyzed the heap dumps using Eclipse Memory Analysis, and found, that many objects were held to do finalization (about 2/3 of the heap):

We found, that it could be some finalize() method blocking. I found several bug reports of this problem (here or here), and it always manifested itself in the Finalizer thread stack, that it was blocked somewhere. But in our case, this thread was WAITING:

"Finalizer" daemon prio=10 tid=0x43e1e000 nid=0x3ff in Object.wait() [0x43dfe000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x4fe053e8> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:133)
        - locked <0x4fe053e8> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:149)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:189)

EDIT:

We then tried to add -XX:+UseConcMarkSweepGC, but with no success, only the frequency of OutOfMemoryErrors diminished, so we first thought it helped.

Finally, we suspected the JVM bug and upgraded from OpenJDK 1.6.0_30 to Oracle JDK 1.7.0_51, and the problem disappeared (at least it seems so, during last 4 hours the used heap does not grow). We do not remember any change in finalize method, nor did we upgrade any library, there were only minor developments during that time. The problem does not reproduce on our test server, with same configuration except that it is 64bit JVM while the production server is 32bit.

The question is: what could be the cause for Objects not being finalized and Finalizer thread waiting for next object? Did we analyze the heap dump correctly?

Thanks for all answers.

解决方案

We think it was related to the OpenJDK version 1.6.0_30. After upgrading to Oracle JDK 1.7.0_51, the problem disappeared. And it probably appeared after automatic update of openJDK, but we cannot confirm this either. We could not find a relevant bug report.

这篇关于对象没有被定稿,Finalizer线程没有做任何事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆