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

ArrayIndexOutOfBoundsException when using Multi kahaDB (mKahaDB) adapter, per-destination adapters and Topics



    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 5.6.0
    • 5.7.0
    • Message Store
    • None
    • Java v1.6.0_21
      Windows XP SP3


      Steps to reproduce the issue:

      • Unpack clean "apache-activemq-5.6.0-bin.zip" to local drive.
      • Change the default configuration to use the mKahaDB adapter and per-destination instances (exactly as given at http://activemq.apache.org/kahadb.html in the very last config snippet). See also attached activemq.xml
      • Start up ActiveMQ from bin/activemq.bat
      • Run a small test program that simply creates a Topic and attempts to consume (that main point here is that the Topic is created and due to "per-destination" mKahaDB, a folder is created in the data directory specifically for this Topic.
      • Shutdown ActiveMQ normally.
      • Restart ActiveMQ normally, and the ArrayIndexOutOfBoundsException will be thrown. (see attached activemq.log)

      I have done some investigation and it seems that on restart when it is attempting to "registerExistingAdapter", it wants to register each adapter with one of the destinations (the first in fact) that each adapter applies to (adapter.getDestinations()...[0]). However, in getDestinations(), empty topics get filtered out of the return value, and since we are using per-destination="true" there can be adapters for topics only and so a chance that getDestinations() returns an empty List. Hence causing the Exception when trying to access the first destination from that list.

      The reason that I haven't gone further, to supply a patch, is that I am unsure of what would be an appropriate way to register these adapters, or if you could leave them and not register them anyway, since they are empty topics.

      Note, that if you extend the configuration of the mKahaDB adapter to provide an explicit adapter for all topics, then the issue goes away. (see commented part of mKahaDB config in activemq.xml attached)


        1. activemq.xml
          6 kB
          Phillip McCarley
        2. activemq.log
          16 kB
          Phillip McCarley
        3. TopicConsumer.java
          0.7 kB
          Phillip McCarley



            Unassigned Unassigned
            mccarl1978 Phillip McCarley
            0 Vote for this issue
            2 Start watching this issue