Search code examples
quickfixj

QuickFix/J not reading logon response and initiating a new logon request continuously


I am using Quickfix/J version 2.3.0. The project is running fine on an environment but having the following issue on another one:

  • Session connected and securities lists are received
  • Heart beats are exchanged normally
  • For one of the heartbeats, no reply, a TEST request is sent
  • Disconnecting: Timed out waiting for heartbeat
  • Logon is sent at 8:53:48.656
  • Logon response is received at 08:53:48.773
  • In the events log: 08:53:59: Disconnecting: Timed out waiting for logon response
  • New logon request initiated at 08:54:18.656
  • Same behavior is repeated for 25 minutes
  • During these 25 minutes, in the event log, optionnally we can see one of the following messages: 08:55:48: Disconnecting: Received logon response before sending request 09:01:49: Disconnecting: Encountered END_OF_STREAM 09:05:49: Received logon 09:06:04: Sent test request TEST 09:06:31: Disconnecting: Timed out waiting for heartbeat
  • After this, we are connected normally, we receive status of securities and market data then once done 09:18:19: Sent test request TEST 09:18:46: Disconnecting: Timed out waiting for heartbeat And the same scenario above of continuous logon is faced again
  • After the scenario is faced again, we can see new kind of errors in the event log:

20230530-09:19:33: quickfix.SessionException Logon state is not valid for message (MsgType=y) 20230530-09:19:33: Already disconnected: Verifying message failed: quickfix.SessionException: Logon state is not valid for message (MsgType=y) 20230530-09:19:33: quickfix.SessionException Logon state is not valid for message (MsgType=y) 20230530-09:19:33: Already disconnected: Verifying message failed: quickfix.SessionException: Logon state is not valid for message (MsgType=y) 20230530-09:19:33: quickfix.SessionException Logon state is not valid for message (MsgType=y) 20230530-09:19:33: Already disconnected: Verifying message failed: quickfix.SessionException: Logon state is not valid for message (MsgType=y) 20230530-09:19:33: quickfix.SessionException Logon state is not valid for message (MsgType=f)

  • After few minutes, we are connected again and everything goes back to normal

This situation is faced during multiple days, and it is not clear how to fix it, especially that the issue is not seen on other servers.

FIX configuration:

[default] ConnectionType=initiator ReconnectInterval=30 FileStorePath=logs/fix FileLogPath=logs/fix StartTime=00:00:00 StartDay=Sun EndTime=23:59:59 EndDay=Sat SocketConnectHost=****

[SESSION] BeginString=FIX.4.4 SenderCompID=**** TargetCompID=**** HeartBtInt=30 ResetOnLogon=Y UseDataDictionary=Y DataDictionary=FIX44.xml ValidateFieldsOutOfOrder=N ValidateUnorderedGroupFields=N SocketConnectHost=**** SocketConnectPort=**** CheckLatency=N

SocketUseSSL=Y CipherSuites=TLS_RSA_WITH_AES_128_CBC_SHA SocketKeyStore=**** SocketKeyStorePassword=**** KeyStoreType=PKCS12 EnabledProtocols=TLSv1


Solution

  • The problem was solved by running the REST API call that was made inside the fromAdmin() in a separate thread to prevent loss of logon messages in case the REST API call takes some time to finish.