[SNMP4J] Bug report: org.snmp4j.util.ThreadPool deadlock

Pashkov Alex outsourcer at yandex.ru
Tue Oct 3 13:34:08 CEST 2006


Hi,
i'm using snmp4j with a thread pool. From time to time the following deadlocks:

...
Java stack information for the threads listed above:
===================================================
"main":
        at org.snmp4j.util.ThreadPool.stop(ThreadPool.java:169)
        - waiting to lock <0x13acc638> (a org.snmp4j.util.ThreadPool$TaskManager)
        - locked <0x13ad1e20> (a org.snmp4j.util.ThreadPool)
        <skipped>

"snmp.0":
        at org.snmp4j.util.ThreadPool$TaskManager.run(ThreadPool.java:240)
        - waiting to lock <0x13ad1e20> (a org.snmp4j.util.ThreadPool)
        - locked <0x13acc638> (a org.snmp4j.util.ThreadPool$TaskManager)

Found 1 deadlock.

Thread "snmp.0" from thread pool executes a task, while "main" thread executes ThreadPool.stop().
So "main" thread first locks ThreadPool.this (via synchronized keyword in stop() definition), then it tries to lock TaskManager.this explicitly to notify() it.
"snmp.0" thread locks TaskManager.this (via synchronized keyword in run() definition), then tries to lock ThreadPool.this to notify() it...

Hope, this helps.

Best regards,
  Pashkov Alexander



More information about the SNMP4J mailing list