java.lang.StackOverflowError

quickfixj.org | 3 months ago
  1. 0

    QuickFIX/J Jira

    quickfixj.org | 6 months ago
    java.lang.StackOverflowError
  2. 0

    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)

    QuickFIX/J JIRA | 9 years ago | Rhys Yarranton
    java.lang.StackOverflowError
  3. 0

    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)

    QuickFIX/J JIRA | 9 years ago | Rhys Yarranton
    java.lang.StackOverflowError
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    QuickFIX/J Jira

    quickfixj.org | 3 months ago
    java.lang.StackOverflowError

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.StackOverflowError

      No message provided

      at java.lang.Exception.<init>()
    2. Java RT
      ObjectOutputStream.defaultWriteObject
      1. java.lang.Exception.<init>(Exception.java:77)
      2. java.lang.reflect.InvocationTargetException.<init>(InvocationTargetException.java:54)
      3. sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
      4. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      5. java.lang.reflect.Method.invoke(Method.java:585)
      6. java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
      7. java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
      8. java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
      9. java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
      10. java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
      11. java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:391)
      11 frames
    3. Apache Log4j
      LoggingEvent.writeObject
      1. org.apache.log4j.spi.LoggingEvent.writeObject(LoggingEvent.java:407)
      1 frame
    4. Java RT
      ObjectOutputStream.writeObject
      1. sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3. java.lang.reflect.Method.invoke(Method.java:585)
      4. java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
      5. java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
      6. java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
      7. java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
      8. java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
      8 frames
    5. Apache Log4j
      SocketAppender.append
      1. org.apache.log4j.net.SocketAppender.append(SocketAppender.java:232)
      1 frame
    6. com.amsl.common
      QuietSocketAppender.append
      1. com.amsl.common.util.QuietSocketAppender.append(QuietSocketAppender.java:79)
      1 frame
    7. Apache Log4j
      Category.warn
      1. org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
      2. org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
      3. org.apache.log4j.Category.callAppenders(Category.java:203)
      4. org.apache.log4j.Category.forcedLog(Category.java:388)
      5. org.apache.log4j.Category.warn(Category.java:1008)
      5 frames
    8. com.amsl.bids3
      FIXGateway.fromAdmin
      1. com.amsl.bids3.fixgw.session.FIXGateway.validateMessageForLatency(FIXGateway.java:777)
      2. com.amsl.bids3.fixgw.session.FIXGateway.fromAdmin(FIXGateway.java:671)
      2 frames
    9. Apache ServiceMix :: Bundles :: ${pkgArtifactId}
      Session.next
      1. quickfix.Session.fromCallback(Session.java:1227)
      2. quickfix.Session.verify(Session.java:1190)
      3. quickfix.Session.nextSequenceReset(Session.java:939)
      4. quickfix.Session.next(Session.java:688)
      5. quickfix.Session.next(Session.java:1487)
      6. quickfix.Session.nextQueued(Session.java:1477)
      7. quickfix.Session.nextQueued(Session.java:1461)
      8. quickfix.Session.next(Session.java:750)
      9. quickfix.Session.next(Session.java:1487)
      9 frames