Skip to content

Changes to update Apache MINA from 2.2.9 to 2.2.10 - #1348

Draft
the-thing wants to merge 2 commits into
quickfix-j:masterfrom
the-thing:mina-update-2-2-10-sandbox
Draft

the-thing wants to merge 2 commits into
quickfix-j:masterfrom
the-thing:mina-update-2-2-10-sandbox

Conversation

@the-thing

@the-thing the-thing commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

There was a MINA bug https://issues.apache.org/jira/projects/DIRMINA/issues/DIRMINA-1199 that could lead to a race condition and unrecoverable SSL errors. This was fixed and tested, but introduced additional synchronization.

Additionally MINA 2.2.9 -> 2.2.10 changed a flag for org.apache.mina.filter.ssl.SSLHandlerG1#ENABLE_ASYNC_TASKS from false to true. For org.apache.mina.filter.ssl.SSLHandlerG0#ENABLE_ASYNC_TASKS was already set to true in 2.2.9.

This seems to be problematic. Either because there are some cases where this combination is failing and was missed by the whole MINA test suite or QuickFIX is using MINA in unsupported way and leads to these problems.

I will have to investigate further. If this flag interaction is the only thing we could make it settable to avoid copying the whole handler implementations.

This PR is not to be merged for the time being or at all...

@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 27.05882% with 434 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.12%. Comparing base (149869e) to head (ca823fa).

Files with missing lines Patch % Lines
...rc/main/java/quickfix/mina/ssl/QFSSLHandlerG0.java 0.00% 254 Missing ⚠️
...rc/main/java/quickfix/mina/ssl/QFSSLHandlerG1.java 45.80% 114 Missing and 54 partials ⚠️
...main/java/quickfix/mina/ssl/AbstractSslFilter.java 57.14% 6 Missing and 3 partials ⚠️
...va/quickfix/mina/ssl/BogusTrustManagerFactory.java 70.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1348      +/-   ##
============================================
- Coverage     70.79%   68.12%   -2.67%     
- Complexity     2270     2328      +58     
============================================
  Files           161      164       +3     
  Lines          9077     9672     +595     
  Branches       1192     1340     +148     
============================================
+ Hits           6426     6589     +163     
- Misses         2198     2574     +376     
- Partials        453      509      +56     

☔ 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.

@the-thing

the-thing commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator Author

It seems like it still fails for SOCKS5 proxy with deadlock. This time only 2 threads involved after changing async flag, but it happens less frequently.

2026-10-18T12:34:44.7873512Z Oct 18, 2026 12:34:44 PM quickfix.test.util.StackTraceUtil findDeadlockedThreads
2026-10-18T12:34:44.7874333Z SEVERE: DEADLOCKED threads:
2026-10-18T12:34:44.7874674Z 
2026-10-18T12:34:44.7875069Z Oct 18, 2026 12:34:44 PM quickfix.test.util.StackTraceUtil printThreadInfo
2026-10-18T12:34:44.7876442Z SEVERE: "NioProcessor-477" Id=5914 BLOCKED on java.util.concurrent.ConcurrentLinkedDeque@1dac52c6 owned by "QFJ Timer" Id=4023
2026-10-18T12:34:44.7877399Z 
2026-10-18T12:34:44.7877482Z 
2026-10-18T12:34:44.7877890Z Oct 18, 2026 12:34:44 PM quickfix.test.util.StackTraceUtil printThreadInfo
2026-10-18T12:34:44.7879254Z SEVERE: "QFJ Timer" Id=4023 BLOCKED on org.apache.mina.proxy.handlers.socks.Socks5LogicHandler@292cf1fb owned by "NioProcessor-477" Id=5914

@chrjohn

chrjohn commented Oct 18, 2026

Copy link
Copy Markdown
Member

Interesting. I only followed the code changes in MINA loosely, but I thought there were only SSL related changes... or is it proxy with SSL?

@the-thing

Copy link
Copy Markdown
Collaborator Author

I didn't look at all the change in detail, but mostly yes - only ssl related. I don't see a test in mina that combines proxy with ssl. We will have to recreate it in MINA, but it looks like the update is not go.

@the-thing

Copy link
Copy Markdown
Collaborator Author

The funny stuff is that some of the test that fail if you run them locally they pass.

@chrjohn

chrjohn commented Oct 18, 2026

Copy link
Copy Markdown
Member

Does not sound too good. Thank you for your investigation. 👍

@the-thing

Copy link
Copy Markdown
Collaborator Author

So I was trying to recreate it directly in MINA, but no luck - everything works fine. The bad news is I don't really understand how proxy + SSL works in QuickFIXj now.

SSL filter should be installed after SSL handshake has completed in org.apache.mina.proxy.AbstractProxyIoHandler#proxySessionOpened, but in QuickFIXj this method is not used at all and SSL is installed beforehand. I'm not sure if there a special flow / setup / flag that makes this work.

I slopped out a SOCKS 4/5 embedded proxy for this test in MINA I might to see how it behaves in QuickFIXj. This is going to be pain as with IDEA not working, simple things take hours / days .

@the-thing

Copy link
Copy Markdown
Collaborator Author

Now I remember - the magic autostart flag, but still not error...

@chrjohn

chrjohn commented Oct 19, 2026

Copy link
Copy Markdown
Member

@the-thing

This is going to be pain as with IDEA not working, simple things take hours / days.

Sorry to hear that. From my experience it works when doing mvn install first. But can only tell for eclipse, netbeans, vs code.
So will try to grab a free intellij version and try to reproduce the next days.

@the-thing

the-thing commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

Thanks. I tried install before and it didn't help.

I'm quite curious if this is something in MINA directly or the way the threads interact in QuickFIXj with some specific lock acquisition order.

If we recreate it in MINA, assuming that API is properly used then it will be a lot easier.

@chrjohn

chrjohn commented Oct 20, 2026

Copy link
Copy Markdown
Member

Hi @the-thing , I saw the MINA issue, thank you. Asked Claude to create a reproducer already yesterday, but did not have time to look at it in more detail. Maybe it is helpful, but maybe not. Please find it attached.
QFSSLHandlerG1DeadlockTest.java

@the-thing

Copy link
Copy Markdown
Collaborator Author

Thanks.

It seems that org.apache.mina.filter.ssl.SSLHandlerG1 is a new problem (nonBlockingPipeline == true), but we don't have tests for org.apache.mina.filter.ssl.SSLHandlerG0 (nonBlockingPipeline == false), which possibly never worked in the first place.

@chrjohn

chrjohn commented Oct 20, 2026

Copy link
Copy Markdown
Member

@the-thing

This is going to be pain as with IDEA not working, simple things take hours / days.

Sorry to hear that. From my experience it works when doing mvn install first. But can only tell for eclipse, netbeans, vs code. So will try to grab a free intellij version and try to reproduce the next days.

Hey, I tried to make this work and it worked for me with the following steps:

./mvnw clean install -Dmaven.javadoc.skip=true -DskipTests -PskipBundlePlugin

Then do the following steps:

  1. Open the Maven tool window. Select quickfixj-messages-all, all the quickfixj-messages-fix* modules, and optionally quickfixj-orchestration. Right-click and choose Ignore Projects.
  2. Click Reload All Maven Projects.
  3. IntelliJ now resolves those dependencies to the jars in ~/.m2, which mvn install already built. It also stops compiling the generated sources, which should fix the out-of-memory error (IIRC you reported that at some time in the past)
  4. If you change the message generation or dictionaries, run ./mvnw install again as stated above, then reload.

NB: there was one test in SessionTest that did not work, but all others I tried worked (incl. SSLCertificateTest).

Does this work for you?

@the-thing

Copy link
Copy Markdown
Collaborator Author

I will check it out tomorrow. Are you saying that after this you can run a single junit test from IDE?

@chrjohn

chrjohn commented Oct 20, 2026

Copy link
Copy Markdown
Member

Are you saying that after this you can run a single junit test from IDE?

Exactly.

@the-thing

Copy link
Copy Markdown
Collaborator Author

It did work - thanks.

@chrjohn

chrjohn commented Oct 21, 2026

Copy link
Copy Markdown
Member

Thanks for the feedback, will add it to the README.

@the-thing

Copy link
Copy Markdown
Collaborator Author

I prototyped the fix for G1 handler in MINA, but old G0 handler is still broken - it was already broken in 2.2.9.

@chrjohn

chrjohn commented Oct 23, 2026

Copy link
Copy Markdown
Member

Also see apache/mina#84

This branch has not been deployed

No deployments
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