Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.1.0
    • Fix Version/s: None
    • Component/s: Engine
    • Labels:

      Description

      When seeking for optimizations for file sync I have come across the FileStore.set method and was wondering about its thread safety. I labelled this issue as improvement, because I am not sure if it is maybe already been taken care of somewhere else, however lets look at this method:

      https://github.com/quickfix-j/quickfixj/blob/045be5c09f872b1bf7b1a8ed2904efd0030c59bd/quickfixj-core/src/main/java/quickfix/FileStore.java#L364

      As you can see, at the very beginning of the function the offset inside the RandomAccessFile is taken as the message offset. The actual writing of the information happens after many more instructions, one of them even including a synchronization on a file descriptor.

      According to my understanding the offset obtained on line 365 could easily be outdated by the time the message is written at line 377. Of course it is possible, that synchronization is supposed to be happening outside of the set method, however I do not see any contract enforcing this in MessageStore.set.

      Should this method not be thread safe to avoid potential data inconsitencies?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              yanicks90 Yanick Salzmann
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: