[QFJ-968] SessionState messageQueue causing out of memory exception Created: 06/Jan/19 Updated: 11/Jan/19 |
|
Status: | Open |
Project: | QuickFIX/J |
Component/s: | Engine |
Affects Version/s: | 2.0.0 |
Fix Version/s: | None |
Type: | Bug | Priority: | Default |
Reporter: | Ryan | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 0 |
Labels: | None | ||
Environment: |
Java 8 |
Description |
Comments |
Comment by Christoph John [ 08/Jan/19 ] |
I am not sure I understand fully: when you want to limit the queue size and discard messages if the queue is full, then why do you do a resend request for that many messages anyway? You could then just not do any resends (e.g. reset to seqnum 1)? Apart from that: if you are transmitting millions of messages in a few hours then I am not sure if FIX is the right choice of protocol. I assume that some kind of volatile data is transmitted (e.g. market data) which in turn leads to the question why you need resends at all if the data is outdated in the meantime anyway. Or did I misunderstand something? Thanks, |
Comment by Ryan [ 09/Jan/19 ] |
Hi Chris - Thank you for the reply! Let me try to give more details. 1. The reason we want to persist these messages is for future analysis. Normally the system works perfectly fine, but we want to handle the rarely happened situation where there is an issue and the system is down in the middle of the day. When that happens, we do need to send resend requests to catch up the outdated data. 2. My understanding is that there are two queues involved:
Every message has to go through the eventQueue, but only messages with higher seqNum will be put into messageQueue. Let's assume the batch size is 20 and consider the following event sequence:
In the given sequence, messages 501-540 will be handled correctly, but 10001-10005 will be added to messageQueue and will not be touched until all messages 501-10000 have been requested and processed. My proposal is to limit the size of the messageQueue (the map) to prevent the unbounded growing. For example if we set the limit to 4 messages, then the message 10005 and later messages will not be added to the messageQueue. When the initiator finishes handling messages 501-10004, it will expect 10005, but since it's discarded, initiator will try to request messages from 10005 to 10024 and move on. This scenario will happen only when both of the following conditions are satisfied:
Hope this better explained the scenario. Thanks, |
Comment by Ryan [ 09/Jan/19 ] |
BTW this is not a blocking issue for us, just want to report what we've observed during the development. |
Comment by Christoph John [ 11/Jan/19 ] |
Hi Ryan, after thinking a little more about it I think it should work the way you said, i.e. if we limited the size of the queued messages QFJ will request them anyway as soon as it has dequeued all messages. I have the following questions: Thanks, |
Comment by Christoph John [ 11/Jan/19 ] |
Of course it will lead to massive number of messages since messages will be re-requested multiple times if the counterparty already sent them and we re-request them because we did not put them to the queue. |
Comment by Ryan [ 11/Jan/19 ] |
Hi Chris, Let me pull the example sequence from above and try to explain my understanding:
Thanks, |