[QFJ-409] Stack overflow when processing a large number of queued messages Created: 03/Mar/09  Updated: 16/Oct/12  Resolved: 16/Oct/12

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.3.2
Fix Version/s: None

Type: Bug Priority: Default
Reporter: JamesM Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Environment:

Java 1.5.0_12 on Linux


Issue Links:
Duplicate
duplicates QFJ-271 StackOverflowError trying to process ... Closed

 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.


Generated at Sun Apr 28 23:11:49 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.