Uploaded image for project: 'JBoss A-MQ'
  1. JBoss A-MQ
  2. ENTMQ-2097

[A-MQ 6, Kahadb] when invalid data is loaded exceptions are treated differently

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • JBoss A-MQ 6.3.x
    • None
    • kahadb
    • None

      When a sequence of "000000" are read in from the store (in error) the broker will assume this is KahaTraceCommand and throws a ClassCastException when it is tried to be cast to a KahaAddCommand. Because it is a ClassCastException it slips out of the org.apache.activemq.store.kahadb.KahaDBStore.loadMessage() and does not invoke the IOExceptionHandler.

       | ERROR | Failed to page in more queue messages  | org.apache.activemq.broker.region.Queue | ActiveMQ BrokerService[XXXXX] Task-300
      java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.activemq.store.kahadb.data.KahaTraceCommand cannot be cast to org.apache.activemq.store.kahadb.data.KahaAddMessageCommand
      	at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.reset(AbstractStoreCursor.java:145) ~[activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.cursors.StoreQueueCursor.reset(StoreQueueCursor.java:159) ~[activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.Queue.doPageInForDispatch(Queue.java:1895) ~[activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.Queue.pageInMessages(Queue.java:2116) ~[activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.Queue.iterate(Queue.java:1581) [activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:133) [activemq-client-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48) [activemq-client-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91]
      	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
      Caused by: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.activemq.store.kahadb.data.KahaTraceCommand cannot be cast to org.apache.activemq.store.kahadb.data.KahaAddMessageCommand
      	at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.fillBatch(AbstractStoreCursor.java:384) ~[activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.reset(AbstractStoreCursor.java:142) ~[activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	... 9 more
      Caused by: java.lang.ClassCastException: org.apache.activemq.store.kahadb.data.KahaTraceCommand cannot be cast to org.apache.activemq.store.kahadb.data.KahaAddMessageCommand
      	at org.apache.activemq.store.kahadb.KahaDBStore.loadMessage(KahaDBStore.java:1132) ~[activemq-kahadb-store-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.store.kahadb.KahaDBStore$KahaDBMessageStore$5.execute(KahaDBStore.java:595) ~[activemq-kahadb-store-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.store.kahadb.disk.page.Transaction.execute(Transaction.java:779) ~[activemq-kahadb-store-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.store.kahadb.KahaDBStore$KahaDBMessageStore.recoverNextMessages(KahaDBStore.java:584) ~[activemq-kahadb-store-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.store.ProxyMessageStore.recoverNextMessages(ProxyMessageStore.java:105) ~[activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.store.ProxyMessageStore.recoverNextMessages(ProxyMessageStore.java:105) ~[activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.cursors.QueueStorePrefetch.doFillBatch(QueueStorePrefetch.java:109) ~[activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.fillBatch(AbstractStoreCursor.java:381) ~[activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.reset(AbstractStoreCursor.java:142) ~[activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	... 9 more
      

      However when a slightly different bad sequence of bytes are loaded from the kahadb file incorrect sequence is detected at load time and invokes the IOExceptionHandler .

      ERROR | Failed to load message at: 1084:12816246 | org.apache.activemq.store.kahadb.KahaDBStore | ActiveMQ BrokerService[il3-broker-c-12-vz200] Task-702
      org.apache.activemq.protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).
      	at org.apache.activemq.protobuf.InvalidProtocolBufferException.invalidTag(InvalidProtocolBufferException.java:48) ~[activemq-protobuf-1.1.jar:1.1]
      	at org.apache.activemq.protobuf.CodedInputStream.readTag(CodedInputStream.java:75) ~[activemq-protobuf-1.1.jar:1.1]
      	at org.apache.activemq.store.kahadb.data.KahaAddMessageCommand.mergeUnframed(KahaAddMessageCommand.java:110) ~[activemq-kahadb-store-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.store.kahadb.data.KahaAddMessageCommand.mergeUnframed(KahaAddMessageCommand.java:7) ~[activemq-kahadb-store-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.protobuf.BaseMessage.mergeUnframed(BaseMessage.java:184) ~[activemq-protobuf-1.1.jar:1.1]
      	at org.apache.activemq.protobuf.BaseMessage.mergeUnframed(BaseMessage.java:213) ~[activemq-protobuf-1.1.jar:1.1]
      	at org.apache.activemq.protobuf.BaseMessage.mergeFramed(BaseMessage.java:237) ~[activemq-protobuf-1.1.jar:1.1]
      	at org.apache.activemq.store.kahadb.MessageDatabase.load(MessageDatabase.java:1071) ~[activemq-kahadb-store-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.store.kahadb.KahaDBStore.loadMessage(KahaDBStore.java:1125) [activemq-kahadb-store-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.store.kahadb.KahaDBStore$KahaDBMessageStore$5.execute(KahaDBStore.java:595) [activemq-kahadb-store-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.store.kahadb.disk.page.Transaction.execute(Transaction.java:779) [activemq-kahadb-store-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.store.kahadb.KahaDBStore$KahaDBMessageStore.recoverNextMessages(KahaDBStore.java:584) [activemq-kahadb-store-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.store.ProxyMessageStore.recoverNextMessages(ProxyMessageStore.java:105) [activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.store.ProxyMessageStore.recoverNextMessages(ProxyMessageStore.java:105) [activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.cursors.QueueStorePrefetch.doFillBatch(QueueStorePrefetch.java:109) [activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.fillBatch(AbstractStoreCursor.java:381) [activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.cursors.AbstractStoreCursor.reset(AbstractStoreCursor.java:142) [activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.cursors.StoreQueueCursor.reset(StoreQueueCursor.java:159) [activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.Queue.doPageInForDispatch(Queue.java:1895) [activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.Queue.pageInMessages(Queue.java:2116) [activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.broker.region.Queue.iterate(Queue.java:1581) [activemq-broker-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:133) [activemq-client-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48) [activemq-client-5.11.0.redhat-621159.jar:5.11.0.redhat-621159]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91]
      	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
      

      Can the broker handle these invalid data exception scenarios in a consistent way.

              gtully@redhat.com Gary Tully
              rhn-support-pfox Patrick Fox (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: