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

Improper use of synchronized keyword

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.2.0
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      All

      Description

      In the quickfix.SocketInitiator class, lines [77, 84] are as follows (version 1.1.0 source code):

      private void initialize() throws ConfigError {
      synchronized (isStarted) {
      if (isStarted == Boolean.FALSE)

      { initiateSessions(eventHandlingStrategy); }

      isStarted = Boolean.TRUE;
      }
      }

      which incorrectly uses the synchronized keyword because Java locks on objects not variables. In other words, threads would lock on Boolean.TRUE and Boolean.FALSE, which could in turn cause deadlocks.

        Attachments

          Activity

            People

            • Assignee:
              admin Steve Bate
              Reporter:
              qiyan@oanda.com Qiyan Li
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: