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

SessionSchedule race condition causes disconnect at midnight UTC

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.0 B3, 1.0.0 Final, 1.0.1, 1.1.0
    • Fix Version/s: 1.0.2
    • Component/s: Engine
    • Labels:
      None

      Description

      The current implementation of Session.checkSessionTime() has a race condition caused
      by multiple calls to System.currentTimeMillis(). (Not a thread access race, but a race against
      the wall clock.) This will not be caught by the Junit tests unless you happen to be running them
      right around midnight on a slow computer, but it's QUITE LIKELY to be seen in a running server
      with multiple sessions open every night!

      Suppose the method is entered just before midnight UTC, e.g. 23:59:59.999, and the clock has
      not yet ticked over by the time the SessionSchedule fields are updated by adjustSessionTimes.

      But then the calls to "getTimeOnly" occur after the clock has ticked over and isDailySessionTime
      starts comparing times from yesterday against the new "time only" calendar instance.

      The end result is a "false" return from checkSessionTime when it really should be true, leading
      to disconnect.

        Attachments

          Activity

            People

            • Assignee:
              admin Steve Bate
              Reporter:
              seh4nc Scott Harrington
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: