Skip to content

Fix logonSent state when MessageStore fails to persist Logon - #1322

Open
aymenjam wants to merge 3 commits into
quickfix-j:masterfrom
aymenjam:bug/Session-state-is-set-incorrectly1302
Open

Fix logonSent state when MessageStore fails to persist Logon#1322
aymenjam wants to merge 3 commits into
quickfix-j:masterfrom
aymenjam:bug/Session-state-is-set-incorrectly1302

Conversation

@aymenjam

@aymenjam aymenjam commented Sep 8, 2026

Copy link
Copy Markdown

Problem

When the MessageStore fails to persist the outgoing Logon message (e.g. an IOException), Session#generateLogon() still marks logonSent as true, even though the Logon was never actually sent. This leaves the session in an inconsistent state.

Fixes #1302

Solution

Both generateLogon() overloads in Session.java now set logonSent based on the actual boolean result returned by sendRaw(), instead of setting it unconditionally beforehand.

Testing

Added testLogonNotMarkedAsSentWhenMessageStorePersistFails in SessionTest.java, which mocks a MessageStore that throws an IOException on persist, and verifies that logonSent remains false in that case.

All existing SessionTest tests still pass.

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.65%. Comparing base (02ba7a3) to head (6d67b9f).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1322      +/-   ##
============================================
+ Coverage     70.58%   70.65%   +0.06%     
- Complexity     2253     2255       +2     
============================================
  Files           159      159              
  Lines          9064     9064              
  Branches       1192     1192              
============================================
+ Hits           6398     6404       +6     
+ Misses         2203     2199       -4     
+ Partials        463      461       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chrjohn chrjohn changed the title Fix logonSent state when MessageStore fails to persist Logon (#1302) Fix logonSent state when MessageStore fails to persist Logon Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session state is set incorrectly when MessageStore cannot persist Logon message

2 participants