[Quickfix-users] Possible bug in the Parser when receiving huge amounts through th e socket
Brought to you by:
orenmnero
From: <em...@co...> - 2004-12-09 16:16:09
|
Here is the scenario. At the moment the socket buffer in the parser is 4096. So, I have recently generated a lot of traffic so I constantly receive of 4096 bytes on the socket and have encountered the following problem. The end of the incoming buffer (m_buffer) of 4096 is as follows (some of the values have been substituted to hide trading details): 8=FIX.4.29=29135=834=156110369=3145052=20041209-15:35:32.68749=BLA50= G56=D33030N60=20041209-15:35:3259=055=GE54=148=BLA000060467107=BLF51 67=FUT44=9740.0041=040=239=038=1037=20041209004077151=10150=020=09 717=6796017=0068712004120909353214=011=000679606=0432=200412091=123456 7810=0978=F As we can see, when the parser gets to parsing this part of the buffer, it will extract the length of the valid message which is 294 (9=291) and in turn send of the message for processing into the application code, etc. After, it has processed the message the buffer then looks like: 8=F This is because the rest of the message is resting on the socket to be read so a valid FIX message can be composed. As you can see there is a 8=F at the end which was received into the buffer, and more data is left over on the socket to be read into the buffer. But, at the moment what the parser will do is make 8=F into a fix message as this is where the buffer is ending, and will try and extract length from it, and this generates a series of exceptions (FieldConvertError, MessageParseError, FieldNotFound and InvalidMessage). Once the parser tries to parse this message, and throws its exceptions, it will get around to reading the socket again and receiving the following into buffer: IX.4.29=34935=834=156111369=3145052=20041209-15:35:32.69249=BLA50=G5 6=D33030N60=20041209-15:35:3259=055=GE54=148=CME000060467107=BLF5167= FUT44=9740.0041=040=239=238=1037=20041209004077337=0C032=1031=9740. 00151=0150=220=09717=6796017=00687220041209093532TN000284375=20041209 14=011=00067960375=BLA030A16=0432=200412091=1234567810=178 Once this is received the m_buffer is "8=F" and m_readBuffer is as above. When the parser appends m_readBuffer to m_buffer the message looks like: 8=FIX.4.29=34935=834=156111369=3145052=20041209-15:35:32.69249=BLA50= G56=D33030N60=20041209-15:35:3259=055=GE54=148=CME000060467107=BLF51 67=FUT44=9740.0041=040=239=238=1037=20041209004077337=0C032=1031=97 40.00151=0150=220=09717=6796017=00687220041209093532TN000284375=200412 0914=011=00067960375=BLA030A16=0432=200412091=1234567810=178 a COMPLETE message as it should be. Now surely, if this kind of scenario is encountered the parser should not even attempt to parse the message, as it is incomplete. I think that there needs to be an extra safeguard in the parser that needs to check presence of field 10 (Standard Trailer) in order to verify that it is a complete message. If anyone has any ideas how to solve this, please be my guess as it has taken my over 2 days just to track this problem down. Thanks a lot Emir --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.766 / Virus Database: 513 - Release Date: 9/17/2004 |