Quickfix session setup : logout sent before logon from initiator
My QuickFIX client is sending logout before login everyday. Is it possible not to have this logout message sent before login ... ?
Followings are the setting I am using now:
[default]
FileStorePath=/home/quickfix/crons/exe/quickfix/filestore
ConnectionType=initiator
SenderCompID=TN7_42
TargetCompID=EMS
SocketConnectHost=xxxxx
TimeZone=Asia/Tokyo
StartTime=07:50:00 Asia/Tokyo
EndTime=20:00:00 Asia/Tokyo
HeartBtInt=30
ReconnectInterval=5
CheckLatency=N
UseLocalTime=Y
[session]
BeginString=FIX.4.2
SocketConnectPort=12061
ResetOnLogon=Y
ResetOnLogout=Y
ResetOnDisconnect=Y
RefreshOnLogon=N
.. and following is the log message I get everyday:
Oct 11, 2011 7:56:00 AM quickfix.SessionSchedule <init>
IN开发者_运维知识库FO: [FIX.4.2:TN7_42->EMS] daily, 22:50:00-UTC - 11:00:00-UTC
<20111010-22:56:00.820, FIX.4.2:TN7_42->EMS, event> (Session FIX.4.2:TN7_42->EMS schedule is daily, 22:50:00-UTC - 11:00:00-UTC)
<20111010-22:56:00.821, FIX.4.2:TN7_42->EMS, event> (Session state is not current; resetting FIX.4.2:TN7_42->EMS)
<20111010-22:56:00.821, FIX.4.2:TN7_42->EMS, event> (Created session: FIX.4.2:TN7_42->EMS)
Oct 11, 2011 7:56:00 AM quickfix.mina.NetworkingOptions logOption
INFO: Socket option: SocketTcpNoDelay=true
Oct 11, 2011 7:56:00 AM quickfix.mina.NetworkingOptions logOption
INFO: Socket option: SocketSynchronousWrites=false
Oct 11, 2011 7:56:00 AM quickfix.mina.NetworkingOptions logOption
INFO: Socket option: SocketSynchronousWriteTimeout=30000
Oct 11, 2011 7:56:00 AM quickfix.mina.initiator.IoSessionInitiator <init>
INFO: [FIX.4.2:TN7_42->EMS] [/xxxxx:12061]
Oct 11, 2011 7:56:00 AM quickfix.mina.SessionConnector startSessionTimer
INFO: SessionTimer started
Oct 11, 2011 7:56:00 AM quickfix.mina.initiator.InitiatorIoHandler sessionCreated
INFO: MINA session created for FIX.4.2:TN7_42->EMS: local=/xxxxx:48477, class org.apache.mina.transport.socket.nio.SocketSessionImpl, remote=/xxxxx:12061
<20111010-22:56:01.860, FIX.4.2:TN7_42->EMS, outgoing> (8=FIX.4.2^A9=52^A35=5^A34=1^A49=TN7_42^A52=20111010-22:56:01.859^A56=EMS^A10=085^A)
Oct 11, 2011 7:56:01 AM quickfix.Session disconnect
INFO: [FIX.4.2:TN7_42->EMS] Disconnecting: Session reset
Oct 11, 2011 7:56:05 AM quickfix.mina.initiator.InitiatorIoHandler sessionCreated
INFO: MINA session created for FIX.4.2:TN7_42->EMS: local=/xxxxx:48478, class org.apache.mina.transport.socket.nio.SocketSessionImpl, remote=/xxxxx:12061
<20111010-22:56:06.844, FIX.4.2:TN7_42->EMS, outgoing> (8=FIX.4.2^A9=70^A35=A^A34=1^A49=TN7_42^A52=20111010-22:56:06.844^A56=EMS^A98=0^A108=30^A141=Y^A10=166^A)
<20111010-22:56:06.845, FIX.4.2:TN7_42->EMS, event> (Initiated logon request)
<20111010-22:56:06.847, FIX.4.2:TN7_42->EMS, incoming> (8=FIX.4.2^A9=179^A35=5^A49=EMS^A56=TN7_42^A34=1^A43=N^A52=20111010-22:56:06.846^A58=Catastropic Error: Incoming sequence number (1) is less than expected (2) without PossDupFlag being set. Logging out.^A10=226^A)
Oct 11, 2011 7:56:06 AM quickfix.Session disconnect
INFO: [FIX.4.2:TN7_42->EMS] Disconnecting: IO Session closed
<20111010-22:56:06.849, FIX.4.2:TN7_42->EMS, error> (quickfix.SessionException Logon state is not valid for message (MsgType=5))
<20111010-22:56:06.849, FIX.4.2:TN7_42->EMS, event> (Already disconnected: Verifying message failed: quickfix.SessionException: Logon state is not valid for message (MsgType=5))
<20111010-22:56:10.887, FIX.4.2:TN7_42->EMS, error> (java.net.ConnectException: java.net.ConnectException: Connection refused(Next retry in 5000 milliseconds))
<20111010-22:56:15.898, FIX.4.2:TN7_42->EMS, error> (java.net.ConnectException: java.net.ConnectException: Connection refused(Next retry in 5000 milliseconds))
You're being bitten by bug QFJ-357, which although it is against the Java project also seems to be an issue for the straight C++ version.
This has actually been fixed in trunk for C++ by the fix in revision 2269.
Incoming sequence number is less than expected
This says it all. The sequence number being sent in the FIX message to the acceptor has a different sequence number then expected from the acceptor, hence the forced logoff message. This is done primarily to keep both the acceptor and initiator in sync while sending and receiving messages.
There is a flag in the config which mentions to reset all sequence numbers during connection. Use that flag to get over this problem for now, but better stick with the original sequence numbers. In the reject message you should get the sequence number being expected by the acceptor. Parse the sequence number and then start the logon process again.
Try making your session end time a bit earlier, and confirm that you are actually sending a logout due to the end time being reached, and not just terminating your application without logging out.
There also have been one or two bugs in QuickFIX around this area which did not exist in 1.12, so you might try that older version and see if it works better for you.
精彩评论