Qpid
  1. Qpid
  2. QPID-4782

[Java Broker] ConnectionAdapter.getSessions() can cause a ConcurrentModificationException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.20
    • Fix Version/s: 0.22
    • Component/s: Java Broker
    • Labels:
      None

      Description

      Changes made via QPID-4760 exposed a defect in ConnectionAdapter.getSessions() which can cause a ConcurrentModificationException. This is due to unsafe use of map.remove() whilst iterating the map keyset. The code will be change to use an Iterator and call iterator.remove instead.

      Recent test failure stacktrace showing the issue:

      IoReceiver - /127.0.0.1:60051 2013-04-26 15:25:31,050 ERROR [qpid.server.transport.ServerSessionDelegate] Exception processing command
      java.util.ConcurrentModificationException
      	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:806)
      	at java.util.HashMap$KeyIterator.next(HashMap.java:841)
      	at org.apache.qpid.server.model.adapter.ConnectionAdapter.getSessions(ConnectionAdapter.java:67)
      	at org.apache.qpid.server.model.adapter.ConnectionAdapter.getSessionAdapter(ConnectionAdapter.java:97)
      	at org.apache.qpid.server.model.adapter.QueueAdapter.getSessionAdapter(QueueAdapter.java:118)
      	at org.apache.qpid.server.model.adapter.QueueAdapter.subscriptionRegistered(QueueAdapter.java:616)
      	at org.apache.qpid.server.queue.SimpleAMQQueue.registerSubscription(SimpleAMQQueue.java:447)
      	at org.apache.qpid.server.transport.ServerSessionDelegate.messageSubscribe(ServerSessionDelegate.java:266)
      	at org.apache.qpid.server.transport.ServerSessionDelegate.messageSubscribe(ServerSessionDelegate.java:73)
      

        Activity

        Hide
        Robbie Gemmell added a comment -

        r1476583 merged to the 0.22 release branch via: http://svn.apache.org/r1477567

        Show
        Robbie Gemmell added a comment - r1476583 merged to the 0.22 release branch via: http://svn.apache.org/r1477567
        Hide
        Robbie Gemmell added a comment -
        Show
        Robbie Gemmell added a comment - Fix made via http://svn.apache.org/r1476583

          People

          • Assignee:
            Robbie Gemmell
            Reporter:
            Robbie Gemmell
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development