Skip to content

MdcInjectionFilterTest - added additional event filtering - #67

Closed
the-thing wants to merge 923 commits into
apache:trunkfrom
the-thing:mdc-infjection-filtert-test-fix
Closed

the-thing wants to merge 923 commits into
apache:trunkfrom
the-thing:mdc-infjection-filtert-test-fix

Conversation

@the-thing

Copy link
Copy Markdown
Member

https://github.com/apache/mina/actions/runs/35831174047/job/107083881501

org.apache.mina.filter.logging.MdcInjectionFilterTest#testOnlyRemoteAddress sometimes fails due to additional log event sneaking in without remote address:

There are already some comments about logging in this file causing problems with MdcInjectionFilterTest

// LOG.debug("Processing ..."); // This log hurts one of

The disposing sessions log is quite new.

Changes

  • filter log events org.apache.mina.filter.logging.MdcInjectionFilterTest#testOnlyRemoteAddress coming from IoProcessor logger

The test still processes and verifies org.apache.mina.core.filterchain.IoFilter events such as:

Firing a SESSION_CREATED event for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a SESSION_CREATED event for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
sessionCreated / org.apache.mina.filter.logging.MdcInjectionFilterTest
sessionCreated / org.apache.mina.filter.logging.MdcInjectionFilterTest
Event SESSION_CREATED has been fired for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Event SESSION_CREATED has been fired for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a SESSION_OPENED event for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a SESSION_OPENED event for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
DummyIoFilter.sessionOpened / org.apache.mina.filter.logging.MdcInjectionFilterTest
DummyIoFilter.sessionOpened / org.apache.mina.filter.logging.MdcInjectionFilterTest
sessionOpened / org.apache.mina.filter.logging.MdcInjectionFilterTest
sessionOpened / org.apache.mina.filter.logging.MdcInjectionFilterTest
Event SESSION_OPENED has been fired for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Event SESSION_OPENED has been fired for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a MESSAGE_RECEIVED event for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a MESSAGE_RECEIVED event for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Processing a MESSAGE_RECEIVED for session 1 / org.apache.mina.filter.codec.ProtocolCodecFilter
Processing a MESSAGE_RECEIVED for session 3 / org.apache.mina.filter.codec.ProtocolCodecFilter
decode / org.apache.mina.filter.logging.MdcInjectionFilterTest
decode / org.apache.mina.filter.logging.MdcInjectionFilterTest
messageReceived-1 / org.apache.mina.filter.logging.MdcInjectionFilterTest
messageReceived-1 / org.apache.mina.filter.logging.MdcInjectionFilterTest
messageReceived-2 / org.apache.mina.filter.logging.MdcInjectionFilterTest
messageReceived-2 / org.apache.mina.filter.logging.MdcInjectionFilterTest
encode / org.apache.mina.filter.logging.MdcInjectionFilterTest
encode / org.apache.mina.filter.logging.MdcInjectionFilterTest
Firing a WRITE event for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a WRITE event for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Event WRITE has been fired for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
encode / org.apache.mina.filter.logging.MdcInjectionFilterTest
Event WRITE has been fired for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a WRITE event for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
encode / org.apache.mina.filter.logging.MdcInjectionFilterTest
Firing a WRITE event for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Event WRITE has been fired for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Event WRITE has been fired for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a EXCEPTION_CAUGHT event for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a EXCEPTION_CAUGHT event for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
exceptionCaught / org.apache.mina.filter.logging.MdcInjectionFilterTest
exceptionCaught / org.apache.mina.filter.logging.MdcInjectionFilterTest
Event EXCEPTION_CAUGHT has been fired for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Event EXCEPTION_CAUGHT has been fired for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Event MESSAGE_RECEIVED has been fired for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Event MESSAGE_RECEIVED has been fired for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a MESSAGE_SENT event for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a MESSAGE_SENT event for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
messageSent-1 / org.apache.mina.filter.logging.MdcInjectionFilterTest
messageSent-1 / org.apache.mina.filter.logging.MdcInjectionFilterTest
messageSent-2 / org.apache.mina.filter.logging.MdcInjectionFilterTest
messageSent-2 / org.apache.mina.filter.logging.MdcInjectionFilterTest
Event MESSAGE_SENT has been fired for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Event MESSAGE_SENT has been fired for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a MESSAGE_SENT event for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a MESSAGE_SENT event for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
messageSent-1 / org.apache.mina.filter.logging.MdcInjectionFilterTest
messageSent-1 / org.apache.mina.filter.logging.MdcInjectionFilterTest
messageSent-2 / org.apache.mina.filter.logging.MdcInjectionFilterTest
messageSent-2 / org.apache.mina.filter.logging.MdcInjectionFilterTest
Event MESSAGE_SENT has been fired for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Event MESSAGE_SENT has been fired for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a SESSION_IDLE event for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a SESSION_IDLE event for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
sessionIdle / org.apache.mina.filter.logging.MdcInjectionFilterTest
sessionIdle / org.apache.mina.filter.logging.MdcInjectionFilterTest
Firing a CLOSE event for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a CLOSE event for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Event CLOSE has been fired for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Event CLOSE has been fired for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Event SESSION_IDLE has been fired for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
Event SESSION_IDLE has been fired for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a SESSION_CLOSED event for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Firing a SESSION_CLOSED event for session 1 / org.apache.mina.core.filterchain.IoFilterEvent
sessionClosed / org.apache.mina.filter.logging.MdcInjectionFilterTest
sessionClosed / org.apache.mina.filter.logging.MdcInjectionFilterTest
Event SESSION_CLOSED has been fired for session 3 / org.apache.mina.core.filterchain.IoFilterEvent
Event SESSION_CLOSED has been fired for session 1 / org.apache.mina.core.filterchain.IoFilterEvent

jon-valliere and others added 30 commits September 9, 2021 12:46
Removes API element which does not exist in JDK8
Errors captured during async tasks will now be stored and re-thrown
during valid filterchain operations.  This allows the filterchain to
capture exceptions.  I may need to disable ENABLE_ASYNC_TASKS later to
ensure that the filterchain captures all exceptions quickly.
DIRMINA-1152: IoServiceStatistics introduces huge latencies
* Adds SSL inboundDone check and throws illegal state
* Fixes spelling mistake in SSLHandler
* Read/Write improvements to SslFilterTest
* Adds ENABLE_SOFT_CLOSURE as a toggle
o Addition of Javadoc
This is necessary when a TLS error has occured and teh inbound is
therefore closed, the Alert must still be sent to the remote peer.
o Added some missing Javadoc
o Code formatting to respect the MINA current code style (no useless
final, this, added missing {}, added NL, etc)
o Used meaningful variable nales
o Removed useless 'this'
o Removed useless 'final'
o Transmitted the nexwt filter to the throw_pending_error() method in order to be able to write back the Alert to the remote peer
o Write the Alter back to the remote peer in the receive_loop() method when the inbound has been closed following an error while processing a task
o Quick exit the receive_loop() method if the read message is empty
o Minor formatting (added nl, etc)
o Added missing javadoc
…s repo does not contain anymore the 2.2.0 release
elecharny and others added 24 commits June 17, 2026 18:24
interacting with a MDC test (which has tobe fixed)
o Don't increase the number of written messages when the message is a
TLS one (DIRMINA-1146)
o Simplified the messageSent method in SslFilter
o Cleaned up the SslFilterTest
o Added a test to check that messages sent are correctly counted when
using TLS (DIRMINA-1146)
[DIRMINA-1146] Additional unit test checks
…mat change in IoBuffer.putObject/getObject)
…s-id

SslIdentificationAlgorithmTest - do not resolve DNS for custom hostnames
- use timeouts to avoid waiting indefinitely
@the-thing the-thing closed this Sep 24, 2026
@the-thing

Copy link
Copy Markdown
Member Author

Wrong branch... :(

@elecharny

Copy link
Copy Markdown
Contributor

FTR, we have 3 'live' branches:

  • 2.2.X, the latest branch
  • 2.1.X, the 2.1 support branch
  • 2.0.X, the 2.0 support branch

The question is whether we backport the fixes from 2.2.X to 2.1.X and 2.0.X or decide to 'kill' the two latest branches...

The problem being that we have pretty much 40% of the downloads for those versions (and we are talking about more than 1M download every month...):

2.0.X: 346 417 downloads last month
2.1.X: 111 578 downloads last month
2.2.X: 648 913 downloads last month

(we even have 23 149 downloads for MINA 1.1.X which is 'dead' since April 23th 2008... 18 years ago!)

@the-thing

Copy link
Copy Markdown
Member Author

That's a good point. I assumed that 2.2.x is the only one used. I will port this one - #68 to other branches as well.

I will also look at the additional changes I made to 2.2.x and try to merge it.

@elecharny

Copy link
Copy Markdown
Contributor

Wait, the idea is probably to have a discussion about whether we maintain those branches or not.
Mina 2.0.X branch was started in 2008
Mina 2.1.X branch was started in 2019

At some point, it's pretty sure they have many issues that aren't fixed.
I have spent a hell lot of time late spring fixing CVEs and backporting them to those branches, and I'm not sure it's really a good move, as it stuck the user to those antiquated versions, instead of pushing them to migrate.

This is a discussion worth to hace on the MINA dev Mailing List IMHO.

@the-thing

Copy link
Copy Markdown
Member Author

Understood. I was looking at the

PR #61
later merged 33b9704

to cherry pick onto 2.1.x, but it diverged quite a bit. This one is more complex though, the test fixes are obviously easier to port.

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.