Skip to content

test and fix for issue 902, solution generated by Junie#1158

Open
david-gibbs-ig wants to merge 6 commits intoquickfix-j:masterfrom
NadexWeb:bugfix/qfj-902
Open

test and fix for issue 902, solution generated by Junie#1158
david-gibbs-ig wants to merge 6 commits intoquickfix-j:masterfrom
NadexWeb:bugfix/qfj-902

Conversation

@david-gibbs-ig
Copy link
Contributor

Submitting this PR to confirm that it builds correctly. My local build environment is not working at all well.

@chrjohn
Copy link
Member

chrjohn commented Mar 9, 2026

Seems like SessionRaceConditionTest is hanging for two hours currently.
Edit: maybe that latch needs a timeout to not hang the complete test suite.

@david-gibbs-ig
Copy link
Contributor Author

@chrjohn Are all these errors related to the change ?

Caused by: java.security.cert.CertPathValidatorException: signature check failed
at java.base/sun.security.provider.certpath.PKIXMasterCertPathValidator.validate(PKIXMasterCertPathValidator.java:135)
at java.base/sun.security.provider.certpath.PKIXCertPathValidator.validate(PKIXCertPathValidator.java:224)
at java.base/sun.security.provider.certpath.PKIXCertPathValidator.validate(PKIXCertPathValidator.java:144)
at java.base/sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(PKIXCertPathValidator.java:83)
at java.base/java.security.cert.CertPathValidator.validate(CertPathValidator.java:309)
at java.base/sun.security.validator.PKIXValidator.doValidate(PKIXValidator.java:313)
... 20 more

@david-gibbs-ig
Copy link
Contributor Author

david-gibbs-ig commented Mar 9, 2026 via email

@david-gibbs-ig
Copy link
Contributor Author

david-gibbs-ig commented Mar 11, 2026

@chrjohn The test can provoke the race condition now.

[INFO] Running quickfix.SessionRaceConditionTest <20260311-14:35:00, FIX.4.4:SENDER->TARGET, event> (Session FIX.4.4:SENDER->TARGET schedule is null) Mar 11, 2026 2:35:00 PM quickfix.UnitTestApplication toAdmin INFO: to admin [FIX.4.4:SENDER->TARGET] 8=FIX.4.4�9=55�35=0�34=1�49=SENDER�52=20260311-14:35:00.607�56=TARGET�10=087� Mar 11, 2026 2:35:00 PM quickfix.UnitTestApplication fromAdmin INFO: from admin [FIX.4.4:SENDER->TARGET] 8=FIX.4.4�9=73�35=A�34=1�49=TARGET�52=20260311-14:35:00.606�56=SENDER�98=0�108=30�141=Y�10=173� <20260311-14:35:00, FIX.4.4:SENDER->TARGET, event> (Created session: FIX.4.4:SENDER->TARGET) [DEBUG_LOG] Attempting to send heartbeats during logon reset delay <20260311-14:35:00, FIX.4.4:SENDER->TARGET, event> (Logon contains ResetSeqNumFlag=Y, resetting sequence numbers to 1) Mar 11, 2026 2:35:01 PM quickfix.UnitTestApplication toAdmin <20260311-14:35:01, FIX.4.4:SENDER->TARGET, event> (Received logon) INFO: to admin [FIX.4.4:SENDER->TARGET] 8=FIX.4.4�9=55�35=0�34=1�49=SENDER�52=20260311-14:35:01.608�56=TARGET�10=089� Mar 11, 2026 2:35:01 PM quickfix.UnitTestApplication toAdmin INFO: to admin [FIX.4.4:SENDER->TARGET] 8=FIX.4.4�9=73�35=A�34=2�49=SENDER�52=20260311-14:35:01.608�56=TARGET�98=0�108=30�141=Y�10=177� <20260311-14:35:01, FIX.4.4:SENDER->TARGET, event> (Responding to Logon request) <20260311-14:35:01, FIX.4.4:SENDER->TARGET, outgoing> (8=FIX.4.4�9=73�35=A�34=2�49=SENDER�52=20260311-14:35:01.608�56=TARGET�98=0�108=30�141=Y�10=177�) Error: Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.021 s <<< FAILURE! -- in quickfix.SessionRaceConditionTest Error: quickfix.SessionRaceConditionTest.testLogonResetRaceCondition -- Time elapsed: 1.018 s <<< FAILURE! java.lang.AssertionError: Outbound Logon should have sequence number 1 when ResetSeqNumFlag=Y expected:<1> but was:<2> at org.junit.Assert.fail(Assert.java:89) at org.junit.Assert.failNotEquals(Assert.java:835) at org.junit.Assert.assertEquals(Assert.java:647) at quickfix.SessionRaceConditionTest.testLogonResetRaceCondition(SessionRaceConditionTest.java:141) at java.lang.reflect.Method.invoke(Method.java:498)

@david-gibbs-ig
Copy link
Contributor Author

david-gibbs-ig commented Mar 11, 2026

@chrjohn I removed the code that did not resolve the bug. Maybe the issue may be solved by synchronization in SessionState, as per its current implementation or perhaps a refactoring with re entrant lock would be better in this class.

Session state class says "The log and message store implementation must be thread safe.", but they are not thread safe. The implementation seems to rely on the Session class.

public void reset() {
        synchronized (lock) {
            try {
                messageStore.reset();
            } catch (IOException e) {
                throw new RuntimeError(e);
            }
        }
  }

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.

2 participants