improving flaky SSLCertificateTest #179
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SSLCertificateTest fails quite often on Travis.
I was able to recreate SSLCertificateTest false positive failing tests locally using the same Travis CI Docker image snapshot as https://travis-ci.org/quickfix-j/quickfixj worker - travisci/ci-garnet:packer-1512502276-986baf0.
It seems that sometimes MINA produces exceptions other than SSLHandshakeException, where org.apache.mina.filter.ssl.SslFilter#exceptionCaught(NextFilter nextFilter, IoSession session, Throwable cause) can stop executing the filter chain (it actually has a special handling routine for WriteToClosedSessionException) , hence the exception is never captured by SSLCertificateTest.
22:17:21.792 [NioProcessor-8] INFO q.m.s.SSLCertificateTest$TestInitiator -
org.apache.mina.core.write.WriteToClosedSessionException: null
at org.apache.mina.core.polling.AbstractPollingIoProcessor.clearWriteRequestQueue(AbstractPollingIoProcessor.java:633)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.removeNow(AbstractPollingIoProcessor.java:576)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.writeBuffer(AbstractPollingIoProcessor.java:923)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.flushNow(AbstractPollingIoProcessor.java:840)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.flush(AbstractPollingIoProcessor.java:767)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$700(AbstractPollingIoProcessor.java:68)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1125)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
The fix is to register test exception handler before MINA org.apache.mina.filter.ssl.SslFilter. I run the test over 20 times on mentioned Docker image and I could not see the issue anymore (on average it took less than 3 consecutive runs to see false positive failure).