Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-5984

Unsafe use of access-order LinkedHashMap via ActiveMQMessageAuditNoSync - can lead to loop and hang

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.12.0
    • 5.13.0
    • Broker, KahaDB
    • None

    Description

      A thread looping in

      "ActiveMQ Transport: tcp:///xxx:yyy@61616" daemon prio=10 tid=0x00007efff40a3000 nid=0x74f0 runnable [0x00007eff6f0f9000]
         java.lang.Thread.State: RUNNABLE
      	at java.util.LinkedHashMap.transfer(LinkedHashMap.java:253)
      	at java.util.HashMap.resize(HashMap.java:581)
      	at java.util.HashMap.addEntry(HashMap.java:879)
      	at java.util.LinkedHashMap.addEntry(LinkedHashMap.java:427)
      	at java.util.HashMap.put(HashMap.java:505)
      	at org.apache.activemq.ActiveMQMessageAuditNoSync.isDuplicate(ActiveMQMessageAuditNoSync.java:133)
      	at org.apache.activemq.store.kahadb.MessageDatabase.upadateIndex(MessageDatabase.java:1238)
      	at org.apache.activemq.store.kahadb.MessageDatabase$AddOpperation.execute(MessageDatabase.java:2196)
      	at org.apache.activemq.store.kahadb.MessageDatabase$15.execute(MessageDatabase.java:1141)
      	at org.apache.activemq.store.kahadb.disk.page.Transaction.execute(Transaction.java:779)
      	at org.apache.activemq.store.kahadb.MessageDatabase.process(MessageDatabase.java:1137)
      	at org.apache.activemq.store.kahadb.MessageDatabase$10.visit(MessageDatabase.java:1005)
      	at org.apache.activemq.store.kahadb.data.KahaCommitCommand.visit(KahaCommitCommand.java:130)....

      points to the need for a write lock on access to the LRUCache used for duplicate detection for failover producers.
      The index lock protects modifications on put etc but clearly a get needs to have exclusive access. Tis in the javadoc in bold - "In access-ordered linked hash maps, merely querying the map with get is a structural modification"

      Attachments

        Activity

          People

            gtully Gary Tully
            gtully Gary Tully
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: