Re: [Quickfix-users] Possible bug in the Parser when receiving hu ge amounts through th e socket
Brought to you by:
orenmnero
From: Kaczmarek, T. <tka...@Cr...> - 2004-12-09 16:59:51
|
On Thu, 2004-12-09 at 16:14 +0000, em...@co... wrote: > QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX FAQ: http://www.quickfixengine.org/wikifix/index.php?QuickFixFAQ > QuickFIX Support: http://www.quickfixengine.org/services.html > > 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 > > --- Would it be too much too ask what version you are running and what you are running it on? Ted DISCLAIMER This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify me and permanently delete the original and any copy of any e-mail and any printout thereof. E-mail transmission cannot be guaranteed to be secure or error-free. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. REGARDING PRIVACY AND CONFIDENTIALITY Crown Financial Group may, at its discretion, monitor and review the content of all e-mail communications. |