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

SleepycatStore can enter infinite loop retrieving messages for resend.

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.3.3
    • Fix Version/s: None
    • Component/s: Engine
    • Labels:
      None

      Description

      SleepycatStore does not check returned OperationStatus from call to com.sleepycat.je.Cursor.getNext(...):

      public synchronized void get(int startSequence, int endSequence, Collection<String> messages) throws IOException {
      ...
      if (retVal == OperationStatus.NOTFOUND)

      { log.debug(sequenceKey + "/" + messageBytes + " not matched in database " + messageDatabase.getDatabaseName()); return; } else {
      Integer sequenceNumber = (Integer) sequenceBinding.entryToObject(sequenceKey);
      while (sequenceNumber.intValue() <= endSequence) {
      messages.add(new String(messageBytes.getData(), charsetEncoding));
      if (log.isDebugEnabled()) { log.debug("Found record " + sequenceNumber + "=>" + new String(messageBytes.getData(), charsetEncoding) + " for search key/data: " + sequenceKey + "=>" + messageBytes); }
      cursor.getNext(sequenceKey, messageBytes, LockMode.DEFAULT);
      sequenceNumber = (Integer) sequenceBinding.entryToObject(sequenceKey);
      }
      }
      ...
      }

      Should be:

      public synchronized void get(int startSequence, int endSequence, Collection<String> messages) throws IOException {
      ...
      if (retVal == OperationStatus.NOTFOUND) { log.debug(sequenceKey + "/" + messageBytes + " not matched in database " + messageDatabase.getDatabaseName()); return; }

      else {
      Integer sequenceNumber = (Integer) sequenceBinding.entryToObject(sequenceKey);
      while (retVal == OperationStatus.SUCCESS && sequenceNumber.intValue() <= endSequence) {
      messages.add(new String(messageBytes.getData(), charsetEncoding));
      if (log.isDebugEnabled())

      { log.debug("Found record " + sequenceNumber + "=>" + new String(messageBytes.getData(), charsetEncoding) + " for search key/data: " + sequenceKey + "=>" + messageBytes); }

      retVal = cursor.getNext(sequenceKey, messageBytes, LockMode.DEFAULT);
      sequenceNumber = (Integer) sequenceBinding.entryToObject(sequenceKey);
      }
      }
      ...
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jim_b_o James Olsen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: