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

Fix concurrent modification in ActiveMQServiceFactory

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 6.0.0, 5.18.4, 5.17.7
    • OSGi/Karaf
    • None

    Description

      Need a class instance level lock or duplicate list around the broker map when doing a .destroy() caused by bundle refesh

      Calling .destroy() loops over a map which calls deleted.. which fails when there is more than one bundle and the bundle is shutdown first (not a service(s) removed via .cfg delete or osgi service shutdown lifecycle).

      #1. OSGi calls..

          synchronized public void destroy() {
              for (String broker : brokers.keySet()) {
                  deleted(broker);
              }
          }
      

      #2. Which blows up here.. due to concurrent modification on the brokers collection

          @Override
          synchronized public void deleted(String pid) {
              ServiceRegistration<BrokerService> reg = brokerRegs.remove(pid);
              if (reg != null) {
                  reg.unregister();
              }
              BrokerService broker = brokers.remove(pid);
              if (broker != null) {
                  stop(pid, broker);
              }
          }
      

      Attachments

        Activity

          People

            mattrpav Matt Pavlovich
            mattrpav Matt Pavlovich
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m