You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "T.Nalbantova via dev" <de...@mina.apache.org> on 2026/04/17 13:53:21 UTC
apache ftp ftplet onDisconnect not invoked when migrate from 2.2.1 to Mina 2.2.2 on tls error
Hi,
Can you please help. We implemented apache ftp server and try to migrate to newer Mina (2.2.5), currently we have Mina 2.2.1. The issue also exists in Mina 2.2.2. Before on TLS error the method onDisconnect of the apache ftp was invoked.
Now it is not and it is somehow related to the changes in Mina project. Can you please advice what to check and do you see workaround? Here is an exception I see in our log file, I hope it can help to find what to fix.
Is it possible to be related to https://issues.apache.org/jira/browse/DIRMINA-1180 ?
Do you think some changes in SslFilter/or extended class can fix the problem (for example in method filterClose or other)?
javax.net.ssl.SSLHandshakeException: (certificate_required) Empty client certificate chain
.......... ...........
at org.apache.mina.filter.ssl.SSLHandlerG0.execute_task(SSLHandlerG0.java:743)
at org.apache.mina.filter.ssl.SSLHandlerG0.receive_loop(SSLHandlerG0.java:255)
at org.apache.mina.filter.ssl.SSLHandlerG0.receive(SSLHandlerG0.java:162)
at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:405)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:49)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1128)
at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:122)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:643)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:539)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$1200(AbstractPollingIoProcessor.java:68)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.process(AbstractPollingIoProcessor.java:1224)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.process(AbstractPollingIoProcessor.java:1213)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:683)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Regards,Tatyana
Re: apache ftp ftplet onDisconnect not invoked when migrate from 2.2.1 to Mina 2.2.2 on tls error
Posted by "T.Nalbantova via dev" <de...@mina.apache.org>.
Hi,
Actually this class not found was because of debug.
Now I see the code that is required has been invoked in TailFilter
s.getHandler().sessionClosed(session);
But in case of TLS error there is not an event for TailFilter and its sessionClosed is not invoked.
In Apache ftp server we extended SslFilter where it can be invoked the code above in sessionClosed
of this filter. Do you think it is suitable workaround and can you confirm the issue related to new design of TLS in Mina and is it related to https://issues.apache.org/jira/projects/DIRMINA/issues/DIRMINA-1180? Do you plan to return the old behavior in case of tls error to invoke
s.getHandler().sessionClosed(session); in TailFilter or other filter or it will not be guaranteed?
Regards,
Tatyana
On Friday, April 24, 2026 at 06:14:00 PM GMT+3, T.Nalbantova via dev <de...@mina.apache.org> wrote:
Hi,
The feature is null and there is not an exception at this code, but when I tested both Mina 2.2.1 and 2.2.5 and debug in parallel seems this code is not invoked for 2.2.5
((AbstractIoService) session.getService()).getListeners().fireSessionDestroyed(session);
fireSessionDestroyed is not invoked I think because of ClassNotFoundException of AbstractIoService and now I will investigate is there something missing in our setup.
The same method in Mina is working for 2.2.1
Regards,Tatyana
On Wednesday, April 22, 2026 at 02:45:21 AM GMT+3, Emmanuel Lecharny <el...@gmail.com> wrote:
Hi
On 4/21/26 16:49, T.Nalbantova via dev wrote:
> Actually the issue is from Mina 2.2.3 and now I try to find how to fix/workaround sessionClosed to be invoked in case of TLS error, because sessionClosed invokes the method onDisconnect of the apache ftplet.
If you get a TLS error, an SSLException should be thrown, and at the
end, it should be handled in the AbstractPollingIoProcess.read(session
method:
...
} catch(Exception e) {
if((einstanceofIOException) &&
(!(einstanceofPortUnreachableException)
|| !AbstractDatagramSessionConfig.class.isAssignableFrom(config.getClass())
|| ((AbstractDatagramSessionConfig) config).isCloseOnPortUnreachable())) {
scheduleRemove(session);
}
IoFilterChain filterChain= session.getFilterChain();
filterChain.fireExceptionCaught(e);
}
}
The fireExceptionCaught method will close the session immediately:
/**
* {@inheritDoc}
*/
@Override
publicvoidfireExceptionCaught(Throwable cause) {
callNextExceptionCaught(head, session, cause);
}
privatevoidcallNextExceptionCaught(Entry entry, IoSession session,
Throwable cause) {
// Notify the related future.
ConnectFuture future= (ConnectFuture)
session.removeAttribute(SESSION_CREATED_FUTURE);
if(future== null) {
try{
IoFilter filter= entry.getFilter();
NextFilter nextFilter= entry.getNextFilter();
filter.exceptionCaught(nextFilter, session, cause);
} catch(Throwable e) {
LOGGER.warn("Unexpected exception from exceptionCaught handler.", e);
}
} else{
// Please note that this place is not the only place that
// calls ConnectFuture.setException().
if(!session.isClosing()) {
// Call the closeNow method only if needed
session.closeNow();
}
future.setException(cause);
}
}
I have not a running test atm, so it's from the top of my head...
Re: apache ftp ftplet onDisconnect not invoked when migrate from 2.2.1 to Mina 2.2.2 on tls error
Posted by "T.Nalbantova via dev" <de...@mina.apache.org>.
Hi,
The feature is null and there is not an exception at this code, but when I tested both Mina 2.2.1 and 2.2.5 and debug in parallel seems this code is not invoked for 2.2.5
((AbstractIoService) session.getService()).getListeners().fireSessionDestroyed(session);
fireSessionDestroyed is not invoked I think because of ClassNotFoundException of AbstractIoService and now I will investigate is there something missing in our setup.
The same method in Mina is working for 2.2.1
Regards,Tatyana
On Wednesday, April 22, 2026 at 02:45:21 AM GMT+3, Emmanuel Lecharny <el...@gmail.com> wrote:
Hi
On 4/21/26 16:49, T.Nalbantova via dev wrote:
> Actually the issue is from Mina 2.2.3 and now I try to find how to fix/workaround sessionClosed to be invoked in case of TLS error, because sessionClosed invokes the method onDisconnect of the apache ftplet.
If you get a TLS error, an SSLException should be thrown, and at the
end, it should be handled in the AbstractPollingIoProcess.read(session
method:
...
} catch(Exception e) {
if((einstanceofIOException) &&
(!(einstanceofPortUnreachableException)
|| !AbstractDatagramSessionConfig.class.isAssignableFrom(config.getClass())
|| ((AbstractDatagramSessionConfig) config).isCloseOnPortUnreachable())) {
scheduleRemove(session);
}
IoFilterChain filterChain= session.getFilterChain();
filterChain.fireExceptionCaught(e);
}
}
The fireExceptionCaught method will close the session immediately:
/**
* {@inheritDoc}
*/
@Override
publicvoidfireExceptionCaught(Throwable cause) {
callNextExceptionCaught(head, session, cause);
}
privatevoidcallNextExceptionCaught(Entry entry, IoSession session,
Throwable cause) {
// Notify the related future.
ConnectFuture future= (ConnectFuture)
session.removeAttribute(SESSION_CREATED_FUTURE);
if(future== null) {
try{
IoFilter filter= entry.getFilter();
NextFilter nextFilter= entry.getNextFilter();
filter.exceptionCaught(nextFilter, session, cause);
} catch(Throwable e) {
LOGGER.warn("Unexpected exception from exceptionCaught handler.", e);
}
} else{
// Please note that this place is not the only place that
// calls ConnectFuture.setException().
if(!session.isClosing()) {
// Call the closeNow method only if needed
session.closeNow();
}
future.setException(cause);
}
}
I have not a running test atm, so it's from the top of my head...
Re: apache ftp ftplet onDisconnect not invoked when migrate from 2.2.1 to Mina 2.2.2 on tls error
Posted by Emmanuel Lecharny <el...@gmail.com>.
Hi
On 4/21/26 16:49, T.Nalbantova via dev wrote:
> Actually the issue is from Mina 2.2.3 and now I try to find how to fix/workaround sessionClosed to be invoked in case of TLS error, because sessionClosed invokes the method onDisconnect of the apache ftplet.
If you get a TLS error, an SSLException should be thrown, and at the
end, it should be handled in the AbstractPollingIoProcess.read(session
method:
...
} catch(Exception e) {
if((einstanceofIOException) &&
(!(einstanceofPortUnreachableException)
|| !AbstractDatagramSessionConfig.class.isAssignableFrom(config.getClass())
|| ((AbstractDatagramSessionConfig) config).isCloseOnPortUnreachable())) {
scheduleRemove(session);
}
IoFilterChain filterChain= session.getFilterChain();
filterChain.fireExceptionCaught(e);
}
}
The fireExceptionCaught method will close the session immediately:
/**
* {@inheritDoc}
*/
@Override
publicvoidfireExceptionCaught(Throwable cause) {
callNextExceptionCaught(head, session, cause);
}
privatevoidcallNextExceptionCaught(Entry entry, IoSession session,
Throwable cause) {
// Notify the related future.
ConnectFuture future= (ConnectFuture)
session.removeAttribute(SESSION_CREATED_FUTURE);
if(future== null) {
try{
IoFilter filter= entry.getFilter();
NextFilter nextFilter= entry.getNextFilter();
filter.exceptionCaught(nextFilter, session, cause);
} catch(Throwable e) {
LOGGER.warn("Unexpected exception from exceptionCaught handler.", e);
}
} else{
// Please note that this place is not the only place that
// calls ConnectFuture.setException().
if(!session.isClosing()) {
// Call the closeNow method only if needed
session.closeNow();
}
future.setException(cause);
}
}
I have not a running test atm, so it's from the top of my head...
Re: apache ftp ftplet onDisconnect not invoked when migrate from 2.2.1 to Mina 2.2.2 on tls error
Posted by "T.Nalbantova via dev" <de...@mina.apache.org>.
Actually the issue is from Mina 2.2.3 and now I try to find how to fix/workaround sessionClosed to be invoked in case of TLS error, because sessionClosed invokes the method onDisconnect of the apache ftplet.
On Friday, April 17, 2026 at 04:53:39 PM GMT+3, T.Nalbantova via dev <de...@mina.apache.org> wrote:
Hi,
Can you please help. We implemented apache ftp server and try to migrate to newer Mina (2.2.5), currently we have Mina 2.2.1. The issue also exists in Mina 2.2.2. Before on TLS error the method onDisconnect of the apache ftp was invoked.
Now it is not and it is somehow related to the changes in Mina project. Can you please advice what to check and do you see workaround? Here is an exception I see in our log file, I hope it can help to find what to fix.
Is it possible to be related to https://issues.apache.org/jira/browse/DIRMINA-1180 ?
Do you think some changes in SslFilter/or extended class can fix the problem (for example in method filterClose or other)?
javax.net.ssl.SSLHandshakeException: (certificate_required) Empty client certificate chain
.......... ...........
at org.apache.mina.filter.ssl.SSLHandlerG0.execute_task(SSLHandlerG0.java:743)
at org.apache.mina.filter.ssl.SSLHandlerG0.receive_loop(SSLHandlerG0.java:255)
at org.apache.mina.filter.ssl.SSLHandlerG0.receive(SSLHandlerG0.java:162)
at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:405)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:49)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1128)
at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:122)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:643)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:539)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$1200(AbstractPollingIoProcessor.java:68)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.process(AbstractPollingIoProcessor.java:1224)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.process(AbstractPollingIoProcessor.java:1213)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:683)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Regards,Tatyana