Skip to content

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

Merged
chrjohn merged 4 commits into
quickfix-j:masterfrom
aymenjam:bug/Session-state-is-set-incorrectly1302
Sep 22, 2026
Merged

chrjohn merged 4 commits into
quickfix-j:masterfrom
aymenjam:bug/Session-state-is-set-incorrectly1302

Conversation

@aymenjam

@aymenjam aymenjam commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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.79%. Comparing base (560200e) to head (de9b7ae).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1322      +/-   ##
============================================
+ Coverage     70.75%   70.79%   +0.04%     
- Complexity     2268     2270       +2     
============================================
  Files           161      161              
  Lines          9077     9077              
  Branches       1192     1192              
============================================
+ Hits           6422     6426       +4     
+ Misses         2199     2198       -1     
+ Partials        456      453       -3     

☔ 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
@chrjohn

chrjohn commented Sep 22, 2026

Copy link
Copy Markdown
Member

Thanks for the PR @aymenjam 👍

@chrjohn chrjohn added this to the QFJ 3.0.3 milestone Sep 22, 2026
@chrjohn
chrjohn merged commit 0ffe2f4 into quickfix-j:master Sep 22, 2026
14 checks passed
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