Qpid
  1. Qpid
  2. QPID-2653

Double checked locking in org.apache.qpid.server.transport.ThreadPoolFilter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 0.7
    • Fix Version/s: 0.7
    • Component/s: Java Broker
    • Labels:
      None

      Description

      org.apache.qpid.server.transport.ThreadPoolFilter has a double check locking in this method:

      private SessionBuffer getSessionBuffer(IoSession session)
      {
      final Map buffers = this.buffers;
      SessionBuffer buf = (SessionBuffer) buffers.get(session);
      if (buf == null)
      {
      synchronized (buffers)
      {
      buf = (SessionBuffer) buffers.get(session);
      if (buf == null)

      { buf = new SessionBuffer(session); buffers.put(session, buf); }

      }
      }
      return buf;
      }

        Issue Links

          Activity

          Sorin Suciu created issue -
          Sorin Suciu made changes -
          Field Original Value New Value
          Attachment 0001-Double-checked-locking-in-org.apache.qpid.server.tra.patch [ 12446684 ]
          Hide
          Robbie Gemmell added a comment -

          The original code, whilst a bit odd looking, does ensure that only 1 new buffer is added to the map. The patch does not, as it synchronizes after checking whether tehre was anything in the map and so multiple threads waiting on the lock could then add to the map. I would look at synchronizing/locking around the get and put.

          Show
          Robbie Gemmell added a comment - The original code, whilst a bit odd looking, does ensure that only 1 new buffer is added to the map. The patch does not, as it synchronizes after checking whether tehre was anything in the map and so multiple threads waiting on the lock could then add to the map. I would look at synchronizing/locking around the get and put.
          Hide
          Sorin Suciu added a comment -

          Agreed Robbie, here comes a better patch I hope.

          Show
          Sorin Suciu added a comment - Agreed Robbie, here comes a better patch I hope.
          Sorin Suciu made changes -
          Attachment qpid-2653.patch [ 12446705 ]
          Hide
          Andrew Kennedy added a comment -

          Duplicate of QPID-2757

          Show
          Andrew Kennedy added a comment - Duplicate of QPID-2757
          Robbie Gemmell made changes -
          Link This issue duplicates QPID-2757 [ QPID-2757 ]
          Robbie Gemmell made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Duplicate [ 3 ]
          Sorin Suciu made changes -
          Assignee Sorin Suciu [ sorins ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          53d 3h 55m 1 Robbie Gemmell 01/Aug/10 17:08

            People

            • Assignee:
              Sorin Suciu
              Reporter:
              Sorin Suciu
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development