[QFJ-32] SessionSchedule race condition causes disconnect at midnight UTC Created: 25/Jun/06  Updated: 02/Sep/06  Resolved: 15/Jul/06

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.0.0 B3, 1.0.0 Final, 1.0.1, 1.1.0
Fix Version/s: 1.0.2

Type: Bug Priority: Minor
Reporter: Scott Harrington Assignee: Steve Bate
Resolution: Fixed Votes: 0
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.



 Comments   
Comment by Steve Bate [ 15/Jul/06 ]

I've redesigned the SessionSchedule class so that it doesn't do a double query of the system time. The changes are on the branch: QFJ_RELEASE_1_0_x (and merged to the trunk).

Generated at Sat Nov 23 00:42:55 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.