ZagTrader

QuickFIX Logon Problems: Session Not Found, CompID Mismatch and Rejected Logons

Written and maintained by ZagTrader. Last reviewed . How this page is sourced and checked

When a QuickFIX session will not log on, the acceptor's log nearly always says why, but the initiator often sees only a closed connection. This guide lists what each engine logs, and what to check on the initiator when you cannot see the acceptor's side.

How an acceptor finds the session

The acceptor reads BeginString (8), SenderCompID (49) and TargetCompID (56) from the first message, reverses the CompIDs (your SenderCompID is its TargetCompID) and looks for a [SESSION] with those values. If none matches, there is no session to answer from, so it closes the connection without a Logout.

EngineWhat the acceptor logs
QuickFIX/JUnknown session ID during logon: FIX.4.4:SELLSIDE->BUYSIDE cannot be found in session list [...], in the application log rather than a session log
QuickFIX/nERROR: Disconnecting; received message for unknown session: ...
QuickFIX C++Session not found for incoming message: ...

Checklist, in the order that finds most problems

  1. CompIDs: compare your SenderCompID and TargetCompID with the counterparty's values, character by character. They are case sensitive, and SubIDs or LocationIDs also take part when configured.
  2. BeginString: both sides on the same version. A different BeginString is a different session ID, so the acceptor does not find the session and closes the connection. The Logout reading "Incorrect BeginString" appears when a message with another BeginString arrives on a session that is already established.
  3. Schedule: a QuickFIX acceptor answers a Logon outside StartTime to EndTime with a Logout reading "Logon attempt not within session time" (QuickFIX/J).
  4. Credentials: if the counterparty wants Username (553) and Password (554), add them in toAdmin when the message is a Logon, or with LogonTag settings in QuickFIX/J. A refused password usually comes back as a Logout with a reason in Text (58).
  5. Network rules: an acceptor with AllowedRemoteAddresses drops connections from other IP addresses. Check the source address the counterparty sees, after NAT.
  6. Duplicate connection: QuickFIX/J refuses a second connection for a session that is already logged on, with "Multiple logons/connections for this session are not allowed". Look for another running instance.
  7. TLS: one side expecting TLS and the other plain TCP gives a connection that closes before any FIX message. See SSL and TLS.

CompID problems after logon

Once the session is up, CheckCompID=Y (the default) rejects any message whose CompIDs do not match the session, with 373=9, and logs out. Turn it off only if the counterparty sends different CompIDs by design, for example a hub that forwards several firms. See CompID problem.

Add credentials to the Logon

QuickFIX/J toAdmin
public void toAdmin(Message message, SessionID sessionID) {
    if (MsgType.LOGON.equals(message.getHeader().getString(MsgType.FIELD))) {
        message.setString(Username.FIELD, user);
        message.setString(Password.FIELD, password);
    }
}

Mask Password (554) in your logs. QuickFIX writes the Logon to the messages log as sent.

Questions

Why does my QuickFIX initiator connect and then disconnect without a Logout?
Usually the acceptor did not find a session for your BeginString and CompIDs, or refused your IP address, so it closed the socket. Ask the counterparty for their acceptor log line.
What is CheckCompID in QuickFIX?
A setting, on by default, that rejects messages whose SenderCompID and TargetCompID do not match the session, with SessionRejectReason 9, and then logs out.
How do I send a username and password on the QuickFIX Logon?
Set Username (553) and Password (554) in the toAdmin callback when the message is a Logon. QuickFIX/J also accepts LogonTag=553=user style settings.

The FIX side of the problem

What the error means on any FIX engine, with example messages you can open in the parser:

Reference

Sources

  1. QuickFIX/J source: AcceptorIoHandler.java (unknown session at logon)
  2. QuickFIX/J source: Session.java (setting names, defaults, logout and reject texts)
  3. QuickFIX/J user manual: Configuration
  4. QuickFIX/n source: SocketReader.cs (unknown session)
  5. QuickFIX/n documentation: Configuration
  6. QuickFIX C++ source: SocketConnection.cpp (session not found)
  7. QuickFIX C++ documentation: Configuration

Setting names, defaults and message texts were checked against the projects' source code and documentation on the review date shown at the top of the page. Behaviour can change between releases; check the version you run. This guide is independent and not affiliated with the QuickFIX projects.

See also

More QuickFIX guides