ActiveMQ
  1. ActiveMQ
  2. AMQ-2696

DefaultJDBCAdapter returns incorrect value that prevents ActiveMQ from starting.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 5.3.1
    • Fix Version/s: 5.4.0
    • Component/s: Message Store
    • Labels:
      None
    • Environment:

      Vista 64bit

      Description

      org.apache.activemq.store.jdbcJDBCPersistenceAdapter.getLastMessageBrokerSequenceId() calls:

      org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter:

      The call to doGetLastMessageStoreSequenceId will return the max acks table id if the max msgs id is less.

      The result is used to seed the sequenceGenerator:

      long seq = getAdapter().doGetLastMessageStoreSequenceId(c);
      sequenceGenerator.setLastSequenceId(seq);

      However the next call to set the brokerSeq variable will fail if the seq variable has been seeded with the max acks id, as 'doGetMessageById' expects a valid msgs id.

      long brokerSeq = 0;
      if (seq != 0)

      { Message last = (Message)wireFormat.unmarshal(new ByteSequence(getAdapter().doGetMessageById(c, seq))); brokerSeq = last.getMessageId().getBrokerSequenceId(); }

      return brokerSeq;

      If 'seq' is not a valid msgs id (I presume because the message has expired and/or been removed) then this causes a NullPointerException in ByteSequence, which is not caught, and this leads to a complete failure to start ActiveMQ.

      The solution is not simple if the tables are in production, and is compounded even further by durable subscribers that cannot simply be deleted from the acks table.

        Issue Links

          Activity

          Andy Gumbrecht created issue -
          Dejan Bosanac made changes -
          Field Original Value New Value
          Assignee Dejan Bosanac [ dejanb ]
          Andy Gumbrecht made changes -
          Affects Version/s 5.4.0 [ 12110 ]
          Dejan Bosanac made changes -
          Affects Version/s 5.3.1 [ 12183 ]
          Fix Version/s 5.4.0 [ 12110 ]
          Dejan Bosanac made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Dejan Bosanac made changes -
          Affects Version/s 5.4.0 [ 12110 ]
          Affects Version/s 5.3.1 [ 12183 ]
          Jeff Turner made changes -
          Project Import Fri Nov 26 22:32:02 EST 2010 [ 1290828722158 ]
          Christian Müller made changes -
          Link This issue is duplicated by AMQ-2956 [ AMQ-2956 ]

            People

            • Assignee:
              Dejan Bosanac
              Reporter:
              Andy Gumbrecht
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development