Skip to content

SessionState#messageQueue is unbound #477

@philipwhiuk

Description

@philipwhiuk

Describe the bug
The message queue in SessionState is unbound. This can lead to a vast quantity of messages being stored in memory which can lead to an OOM error.

In the worst case of a misbehaving FIX engine that doesn't handle resends, this queue grows without limit.

To Reproduce
On the counter-party, induce the side to skip a large volume of sequence numbers. Then start sending messages at a high rate.

The QuickFIXJ FIX engine will cache all the received messages in memory while it waits for the counter-party to process the resend. This will use a potentially infinite amount of memory (but could easily store thousands of messages on a typical high volume system).

Expected behavior
QFJ should only keep a (albeit size-able) limit of messages for a session. Any later messages should be dropped and then handled with a future re-send if necessary.

Implementation notes

Perhaps something like MaxMessagesQueuedWhilePendingResend=2000
We could allow -1 for people who are truly happy with unlimited.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions