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.
| Engine | What the acceptor logs |
|---|---|
| QuickFIX/J | Unknown 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/n | ERROR: Disconnecting; received message for unknown session: ... |
| QuickFIX C++ | Session not found for incoming message: ... |
Checklist, in the order that finds most problems
- 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.
- 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.
- Schedule: a QuickFIX acceptor answers a Logon outside StartTime to EndTime with a Logout reading "Logon attempt not within session time" (QuickFIX/J).
- Credentials: if the counterparty wants Username (553) and Password (554), add them in toAdmin when the message is a Logon, or with
LogonTagsettings in QuickFIX/J. A refused password usually comes back as a Logout with a reason in Text (58). - Network rules: an acceptor with AllowedRemoteAddresses drops connections from other IP addresses. Check the source address the counterparty sees, after NAT.
- 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.
- 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
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
- QuickFIX/J source: AcceptorIoHandler.java (unknown session at logon)
- QuickFIX/J source: Session.java (setting names, defaults, logout and reject texts)
- QuickFIX/J user manual: Configuration
- QuickFIX/n source: SocketReader.cs (unknown session)
- QuickFIX/n documentation: Configuration
- QuickFIX C++ source: SocketConnection.cpp (session not found)
- 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
- QuickFIX/J vs QuickFIX/n vs QuickFIX C++: Which One to Use
- QuickFIX Session Settings Explained: Configuration Reference
- QuickFIX with FIX 5.0 SP2: FIXT.1.1, Transport and Application Dictionaries
- Custom Fields and a Custom Data Dictionary in QuickFIX
- Repeating Groups in QuickFIX: Reading, Writing and Validation Errors
- QuickFIX Session Schedules: Daily vs Weekly Sessions, Time Zones and Sunday to Thursday Markets
- QuickFIX "Tag not defined for this message type": Causes and Fixes
- QuickFIX "Conditionally Required Field Missing": Why Your Handler Caused It
- QuickFIX "Incorrect data format for value": Field Types and Fixes
- QuickFIX "MsgSeqNum too low": Reset Sequence Numbers Safely and Fix the File Store
- QuickFIX SSL and TLS: Setup per Engine and Handshake Failures
- QuickFIX onMessage Not Called: Message Cracking Problems
- Reading and Analyzing QuickFIX Logs: messages.log and event.log