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

        Robbie Gemmell created issue -
        Robbie Gemmell made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Robbie Gemmell made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Rob Godfrey made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development