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

Stack overflow when processing a large number of queued messages

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Default
    • Resolution: Duplicate
    • Affects Version/s: 1.3.2
    • Fix Version/s: None
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Java 1.5.0_12 on Linux

      Description

      This issue is probably related to QFJ-379: http://www.quickfixj.org/jira/browse/QFJ-379

      We noticed that a stack overflow can occur when QuickFIX is processing a very large number of queued messages.

      From the event log file (edited to make the situation clearer):

      MsgSeqNum too high, expecting 1430 but received 4937
      MsgSeqNum too high, expecting 1430 but received 4938
      Received SequenceReset FROM: 1430 TO: 1939

      [...]

      Processing queued message: 4030, pending: [1432, 1433, 1434, ..., 1939, 4031, 4032, ..., 4937, 4938]
      null
      java.lang.StackOverflowError
      at java.nio.Buffer.<init>(Buffer.java:176)
      at java.nio.ByteBuffer.<init>(ByteBuffer.java:259)
      at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:52)
      at java.nio.ByteBuffer.wrap(ByteBuffer.java:350)
      at java.nio.ByteBuffer.wrap(ByteBuffer.java:373)
      at java.lang.StringCoding$CharsetSE.encode(StringCoding.java:339)
      at java.lang.StringCoding.encode(StringCoding.java:378)
      at java.lang.String.getBytes(String.java:812)
      [... application code ...]
      at XXX.YYY.ZZZ.QF_FIXConnectionImpl.fromApp(QF_FIXConnectionImpl.java:219)
      at quickfix.Session.fromCallback(Session.java:1314)
      at quickfix.Session.verify(Session.java:1272)
      at quickfix.Session.verify(Session.java:1343)
      at quickfix.Session.next(Session.java:742)
      at quickfix.Session.next(Session.java:1599)
      at quickfix.Session.nextQueued(Session.java:1589)
      at quickfix.Session.nextQueued(Session.java:1570)
      at quickfix.Session.next(Session.java:796)
      at quickfix.Session.next(Session.java:1599)
      at quickfix.Session.nextQueued(Session.java:1589)
      at quickfix.Session.nextQueued(Session.java:1570)
      at quickfix.Session.next(Session.java:796)
      at quickfix.Session.next(Session.java:1599)
      at quickfix.Session.nextQueued(Session.java:1589)
      at quickfix.Session.nextQueued(Session.java:1570)
      at quickfix.Session.next(Session.java:796)
      at quickfix.Session.next(Session.java:1599)
      at quickfix.Session.nextQueued(Session.java:1589)
      at quickfix.Session.nextQueued(Session.java:1570)
      at quickfix.Session.next(Session.java:796)
      at quickfix.Session.next(Session.java:1599)
      at quickfix.Session.nextQueued(Session.java:1589)
      at quickfix.Session.nextQueued(Session.java:1570)
      at quickfix.Session.next(Session.java:796)
      [....]
      at quickfix.Session.nextQueued(Session.java:1589)
      at quickfix.Session.nextQueued(Session.java:1570)

      Is anyone able to offer any suggestions? I think the next/nextQueued functions may be excessively recursive, which will cause a stack overflow error if the queue of messages to be processed is extremely large.

      I also tried with a thread stack size of 128K, 256K, 512K (-Xss VM option) but see the same problem.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jamesm JamesM
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: