Uploaded image for project: 'QuickFIX/J'
  1. QuickFIX/J
  2. QFJ-563

SocketAcceptor initialization is not properly synchronized

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Default
    • Resolution: Fixed
    • Affects Version/s: 1.5.1
    • Fix Version/s: 1.5.2
    • Component/s: Engine
    • Labels:
      None

      Description

      SocketAcceptor initialization is using Boolean object as both lock and flag. This approach has 2 major problems:
      1) Public object such as Boolean.FALSE should not be used for synchronization. If it is used as lock in multiple places it can lead to performance degradation or deadlock.
      2) Synchronization is done on Boolean.FALSE before initialization and on Boolean.TRUE after initialization but synchronization on 2 different locks do not constitute "happens-before" relationship. It means thread coming shortly after initialization can see changed flag and use Boolean.TRUE for locking and so it uses different lock than the lock used during initialization. As a result this thread can see objects created and updated during initialization in inconsistent state.

      The problem can be fixed by using private not-share object as a lock and boolean value as flag.

        Attachments

          Activity

            People

            • Assignee:
              chrjohn Christoph John
              Reporter:
              kara_cz Jaroslav Sedlacek
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: