4

很抱歉这篇长篇文章,但我想知道在我向 Sun 提交错误报告之前是否可以得到更多的关注。

JVM:6u11
操作系统:Windows XP SP3
硬件:AMD Athlon 64 X2 4600+ @ 2.41GHz,3.25 GB RAM。

我相信我在 JVM 中遇到了一个错误,没有为线程提供监视器。在以下线程跟踪中,监视器<0x12a8f9f8>被 获取RelayedMessages-0000000001,最终等待它;随后通知了该线程。然而,即使列出的所有线程都在争夺监视器,但没有一个线程得到它。

我保证线程转储对于每个引用 monitor 的线程都是完整的<0x12a8f9f8>。转储是使用 Java VisualVM 获得的,在 16 小时内 3 次,并且每次都显示是一致的(这些线程没有变化)。

有没有人不同意我的评估,即 JVM 未能将监视器交付给任何符合条件的线程,什么时候应该将它交付给其中一个?

"RelayedMessages-0000000001" daemon prio=6 tid=0x03694400 nid=0x1750 waiting for monitor entry [0x05e1f000..0x05e1fc94]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at java.lang.Object.wait(Native Method)
    at com.companyremoved.thd.EzWaiter.ezWait(EzWaiter.java:249)
    - locked <0x12a8f9f8> (a com.companyremoved.system.coms.ComsSender)
    at com.companyremoved.ioc.IsolatedObject.waitWithinMessage(IsolatedObject.java:352)
    - locked <0x12a8f9f8> (a com.companyremoved.system.coms.ComsSender)
    at com.companyremoved.system.coms.ComsSender.waitForAvailablePipe(ComsSender.java:219)
    at com.companyremoved.system.coms.ComsSender.sendObject(ComsSender.java:185)
    at com.companyremoved.system.coms.ComsSender.processIocMessage(ComsSender.java:98)
    at com.companyremoved.ioc.IsolatedObject.deliver(IsolatedObject.java:311)
    - locked <0x12a8f9f8> (a com.companyremoved.system.coms.ComsSender)
    at com.companyremoved.ioc.IsolatedObject.iocMessage(IsolatedObject.java:265)
    at com.companyremoved.ioc.IocTarget.iocMessage(IocTarget.java:138)
    at com.companyremoved.ioc.IocBinding.iocMessage(IocBinding.java:105)
    at com.companyremoved.system.coms.ComsSender$Messages.sendObject(ComsSender.java:333)
    at com.companyremoved.system.coms.ComsSender$Messages.sendObject(ComsSender.java:316)
    at com.companyremoved.system.coms.RelayedMessage.run(RelayedMessage.java:104)
    - locked <0x130fe8e0> (a com.companyremoved.system.coms.RelayedMessage)
    at com.companyremoved.thd.RunQueue.runEntry(RunQueue.java:293)
    at com.companyremoved.thd.RunQueue.run(RunQueue.java:273)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"ScbPipe Writer" daemon prio=6 tid=0x4fff0c00 nid=0xf14 waiting for monitor entry [0x0594f000..0x0594fc14]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at com.companyremoved.ioc.IsolatedObject.deliver(IsolatedObject.java:293)
    - waiting to lock <0x12a8f9f8> (a com.companyremoved.system.coms.ComsSender)
    at com.companyremoved.ioc.IsolatedObject.iocMessage(IsolatedObject.java:265)
    at com.companyremoved.ioc.IocTarget.iocMessage(IocTarget.java:138)
    at com.companyremoved.coms.stm.ioc.ComsPipe$Receiver.scbPipeDefaultProcessor(ComsPipe.java:403)
    at com.companyremoved.scb.ScbPipe.processObject(ScbPipe.java:915)
    - locked <0x131a4ea0> (a java.lang.Object)
    at com.companyremoved.scb.ScbPipe.writerRun(ScbPipe.java:817)
    at com.companyremoved.scb.ScbPipe.run(ScbPipe.java:728)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"ScbPipe Writer" daemon prio=6 tid=0x4c647400 nid=0xe00 waiting for monitor entry [0x059ef000..0x059efb94]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at com.companyremoved.ioc.IsolatedObject.deliver(IsolatedObject.java:293)
    - waiting to lock <0x12a8f9f8> (a com.companyremoved.system.coms.ComsSender)
    at com.companyremoved.ioc.IsolatedObject.iocMessage(IsolatedObject.java:265)
    at com.companyremoved.ioc.IocTarget.iocMessage(IocTarget.java:138)
    at com.companyremoved.coms.stm.ioc.ComsPipe$Receiver.scbPipeDefaultProcessor(ComsPipe.java:403)
    at com.companyremoved.scb.ScbPipe.processObject(ScbPipe.java:915)
    - locked <0x13188bb8> (a java.lang.Object)
    at com.companyremoved.scb.ScbPipe.writerRun(ScbPipe.java:817)
    at com.companyremoved.scb.ScbPipe.run(ScbPipe.java:728)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"ScbPipe Writer" daemon prio=6 tid=0x035f7800 nid=0x1130 waiting for monitor entry [0x0726f000..0x0726fc94]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at com.companyremoved.ioc.IsolatedObject.deliver(IsolatedObject.java:293)
    - waiting to lock <0x12a8f9f8> (a com.companyremoved.system.coms.ComsSender)
    at com.companyremoved.ioc.IsolatedObject.iocMessage(IsolatedObject.java:265)
    at com.companyremoved.ioc.IocTarget.iocMessage(IocTarget.java:138)
    at com.companyremoved.coms.stm.ioc.ComsPipe$Receiver.scbPipeDefaultProcessor(ComsPipe.java:403)
    at com.companyremoved.scb.ScbPipe.processObject(ScbPipe.java:915)
    - locked <0x12a8a478> (a java.lang.Object)
    at com.companyremoved.scb.ScbPipe.writerRun(ScbPipe.java:817)
    at com.companyremoved.scb.ScbPipe.run(ScbPipe.java:728)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"IOC Signals-0000000001" daemon prio=6 tid=0x03673000 nid=0x1434 waiting for monitor entry [0x0415f000..0x0415fd94]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at com.companyremoved.ioc.IsolatedObject.deliver(IsolatedObject.java:293)
    - waiting to lock <0x12a8f9f8> (a com.companyremoved.system.coms.ComsSender)
    at com.companyremoved.ioc.IsolatedObject.iocMessage(IsolatedObject.java:265)
    at com.companyremoved.ioc.IocTarget.iocMessage(IocTarget.java:138)
    at com.companyremoved.ioc.IocBinding.iocMessage(IocBinding.java:105)
    at com.companyremoved.system.coms.ComsSender$Messages.removePipe(ComsSender.java:302)
    at com.companyremoved.system.coms.ConnectionController.disconnect(ConnectionController.java:712)
    at com.companyremoved.system.coms.ConnectionController.shutdown(ConnectionController.java:224)
    at com.companyremoved.system.coms.ConnectionController.processIocMessage(ConnectionController.java:168)
    at com.companyremoved.ioc.IsolatedObject.deliver(IsolatedObject.java:311)
    - locked <0x12a8b798> (a com.companyremoved.system.coms.ConnectionController)
    at com.companyremoved.ioc.IsolatedObject.access$100(IsolatedObject.java:36)
    at com.companyremoved.ioc.IsolatedObject$SignalProxy.run(IsolatedObject.java:526)
    at com.companyremoved.thd.RunQueue.runEntry(RunQueue.java:293)
    at com.companyremoved.thd.RunQueue.run(RunQueue.java:273)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None
4

2 回答 2

2

提供的线程跟踪对于所讨论的锁是完整的。与我共事的另外两个人同意明确指出了 JVM 故障,jProfiler (ej-technologies) 的程序员也是如此。

于 2009-01-04T08:57:11.387 回答
1

你确定线程 RelayedMessages-0000000001 得到通知吗?其他线程被阻塞是正常的,因为第一个线程仍然获得 <0x12a8f9f8> 的锁。为了让其他线程能够获得锁,第一个线程应该从等待列表中移除并安排再次运行,然后释放它获得的锁。

可能有其他线程在等待第一个线程等待的同一对象,并且当您说通知时,这些线程被选择唤醒。如果可能,请确保使用 notifyAll()。

也可能您可以在将线程放入等待列表之前释放锁,或者通过提供超时值来调用等待。线程在等待列表中等待 16 小时是没有意义的。如果您还可以发布其他也会有帮助的主题。

更新:

你说得对,我应该考虑到 Thread.State。正如您评论的那样,它没有处于等待状态,因为它已收到通知。那么,在等待列表中并不是不释放锁 <0x12a8f9f8> 的原因。但是,它处于阻塞状态。这意味着,它试图获得它在 object.wait 之前获得的锁,但它不能。因此,似乎有另一个线程(不在您提供的列表中)阻止它。

我想,你在想 object.wait 应该已经释放了锁 <0x12a8f9f8>。但是 object.wait 仅释放该对象监视器上的锁并保留其他锁。而且我认为, lock <0x12a8f9f8> 不是对象监视器的锁(调用等待)

当然,情况可能并非如此,并且可能存在真正的错误。我只是想提出可能的原因。

于 2008-12-16T09:33:34.273 回答