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

StackOverflowError trying to process queued SequenceReset

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Default
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.3.1
    • Component/s: Engine
    • Labels:
      None

      Description

      While testing out of order messages, we ran into the stack overflow at bottom. We are using 1.2.1. I believe this also affects 1.3.0.

      Scenario: Counterparty sends messages through 41 OK, then sends 50 and 51 out of sequence. QF queues these and issues a resend request. Messages 42 through 49 arrive, QF processes 50 from the queue OK then cacks on 51. Message 51 is:
      16:13:27,627 INFO [GATEWAYS.FWST.Incoming] FIX.4.2:BIDS->FWST: 8=FIX.4.2^A9=60^A35=4^A49=FWST^A56=BIDS^A34=51^A52=20071210-21:13:26^A123=Y^A36=51^A10=215^A

      The problem appears to be that message 51 is asking QF to set the next sequence number to 51. QF obediently leaves the sequence number at 51, resulting in an infinite loop, and due to the use of recursion, a stack overflow.

      The FIX 4.2 spec didn't seem too clear to me whether one should issue a reject or ignore the message. Whatever the case, I guess we have to make sure the nasty message gets removed from the buffer.

      Don't know if there are other types of pathological messages. This buffer stuff is kind of tricky, and coupled with the recursion makes me nervous. e.g., you can get an overflow simply because someone sends you a massive plug of out-of-order data.

      java.lang.StackOverflowError
      at java.lang.Exception.<init>(Exception.java:77)
      at java.lang.reflect.InvocationTargetException.<init>(InvocationTargetException.java:54)
      at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
      at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:391)
      at org.apache.log4j.spi.LoggingEvent.writeObject(LoggingEvent.java:407)
      at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
      at org.apache.log4j.net.SocketAppender.append(SocketAppender.java:232)
      at com.amsl.common.util.QuietSocketAppender.append(QuietSocketAppender.java:79)
      at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
      at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
      at org.apache.log4j.Category.callAppenders(Category.java:203)
      at org.apache.log4j.Category.forcedLog(Category.java:388)
      at org.apache.log4j.Category.warn(Category.java:1008)
      at com.amsl.bids3.fixgw.session.FIXGateway.validateMessageForLatency(FIXGateway.java:777)
      at com.amsl.bids3.fixgw.session.FIXGateway.fromAdmin(FIXGateway.java:671)
      at quickfix.Session.fromCallback(Session.java:1227)
      at quickfix.Session.verify(Session.java:1190)
      at quickfix.Session.nextSequenceReset(Session.java:939)
      at quickfix.Session.next(Session.java:688)
      at quickfix.Session.next(Session.java:1487)
      at quickfix.Session.nextQueued(Session.java:1477)
      at quickfix.Session.nextQueued(Session.java:1461)
      at quickfix.Session.next(Session.java:750)
      at quickfix.Session.next(Session.java:1487)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                admin Steve Bate
                Reporter:
                ryarran Rhys Yarranton
              • Votes:
                2 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: