Hi,

in Apache MINA sshd I recently[1] ran into the problem of how to shut
down output on a socket using MINA 2.0.23. Apache MINA sshd had some
code that used reflection to get at the SocketChannel of an
NioSocketSession, and then invoked channel.shutdownOutput() on that
directly.

That kind of worked, but it led to very strange effects where all
SSH tests, when run with MINA, took very long. (Unfortunately I don't
know for sure why because I never could reproduce this locally and the
Apache MINA sshd CI builds on Github don't provide any useful logs after
the build has terminated.)

I did notice in some local tests that quite frequently the
AbstractPollingIoProcessor.Processor entered its "epoll spinning"
code; so maybe that was the reason.

In any case: what's the proper way to half-close an NioSocketSession?

With NIO2, it's no problem. Netty also has a proper DuplexChannel
abstraction via which we can do this. But with MINA, the only working
way for Apache MINA sshd is to call IoSession.closeOnFlush(). That
works for our use case, but it isn't quite the same as a half-closure
via shutdownOutput().

On a related note: what is the proper way in Apache MINA to handle
IoHandler.inputClosed()? As I understand it, that indicates that
whatever is on the other end closed its output. But we may still
write, right? IoHandlerAdapter just closes the session immediately,
though. I tried to use IoSession.suspendRead(), but that again leads
to epoll spinning. Just not closing session (i.e., an empty
implementation of inputClosed()) leads to ClosedByInterruptExceptions
when the session finally is closed.

Any hints?

Cheers,

  Thomas

[1] https://github.com/apache/mina-sshd/pull/227

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@mina.apache.org
For additional commands, e-mail: users-h...@mina.apache.org

Reply via email to