[
https://issues.apache.org/jira/browse/SSHD-666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15281567#comment-15281567
]
Goldstein Lyor commented on SSHD-666:
-------------------------------------
Unfortunately, I do not see many options - if NIO is broken on OSX, then there
isn't much SSHD can do about it - maybe you should try different JVMs - OpenJDK
vs. Oracle, or perhaps other versions where it is not broken (maybe a specific
release of Java 7, 8 ?). Maybe one of them miraculously works (I agree, not
much of a solution). This is distressing since Java should work the same
"anywhere" - the right target of NIO break on OSX issue should be the JVM
provider (Oracle ?).
As far as MINA goes, you should try posting a similar issue on the DIRMINA
project instead of SSHD - maybe they can help. In this case, SSHD is just using
the MINA library as-is.
Finally, if you are only developing on OSX but targeting Linux/Windows then all
I can think of is to compile the code on OSX, deploy it on your target and then
remote debug it - since on Linux/Windows NIO is not broken...
> Nio2Session.close stalled on OSX
> --------------------------------
>
> Key: SSHD-666
> URL: https://issues.apache.org/jira/browse/SSHD-666
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 1.1.1, 1.2.0
> Environment: OSX
> Reporter: Stéphane Landelle
>
> Hi,
> When closing the Nio2Session on OSX, current thread sometimes stalls.
> Here's the thread stacktrace:
> "sshd-SshClient[78c26b64]-nio2-thread-4" #230 daemon prio=5 os_prio=31
> tid=0x00007f978030c800 nid=0xc603 runnable [0x00007000051b1000]
> java.lang.Thread.State: RUNNABLE
> at sun.nio.ch.FileDispatcherImpl.close0(Native Method)
> at sun.nio.ch.SocketDispatcher.close(SocketDispatcher.java:55)
> at
> sun.nio.ch.UnixAsynchronousSocketChannelImpl.implClose(UnixAsynchronousSocketChannelImpl.java:222)
> at
> sun.nio.ch.AsynchronousSocketChannelImpl.close(AsynchronousSocketChannelImpl.java:144)
> at
> org.apache.sshd.common.io.nio2.Nio2Session.doCloseImmediately(Nio2Session.java:197)
> at
> org.apache.sshd.common.util.closeable.AbstractCloseable$1.operationComplete(AbstractCloseable.java:103)
> at
> org.apache.sshd.common.util.closeable.AbstractCloseable$1.operationComplete(AbstractCloseable.java:98)
> at
> org.apache.sshd.common.future.AbstractSshFuture.notifyListener(AbstractSshFuture.java:165)
> at
> org.apache.sshd.common.future.DefaultSshFuture.addListener(DefaultSshFuture.java:159)
> at
> org.apache.sshd.common.util.closeable.AbstractCloseable.close(AbstractCloseable.java:98)
> at
> org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:56)
> at
> org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:46)
> at
> org.apache.sshd.common.future.AbstractSshFuture.notifyListener(AbstractSshFuture.java:165)
> at
> org.apache.sshd.common.future.DefaultSshFuture.notifyListeners(DefaultSshFuture.java:202)
> at
> org.apache.sshd.common.future.DefaultSshFuture.setValue(DefaultSshFuture.java:104)
> at
> org.apache.sshd.common.future.DefaultCloseFuture.setClosed(DefaultCloseFuture.java:49)
> at
> org.apache.sshd.common.util.closeable.ParallelCloseable$1.operationComplete(ParallelCloseable.java:55)
> at
> org.apache.sshd.common.util.closeable.ParallelCloseable$1.operationComplete(ParallelCloseable.java:46)
> at
> org.apache.sshd.common.future.AbstractSshFuture.notifyListener(AbstractSshFuture.java:165)
> at
> org.apache.sshd.common.future.DefaultSshFuture.notifyListeners(DefaultSshFuture.java:202)
> at
> org.apache.sshd.common.future.DefaultSshFuture.setValue(DefaultSshFuture.java:104)
> at
> org.apache.sshd.common.future.DefaultCloseFuture.setClosed(DefaultCloseFuture.java:49)
> at
> org.apache.sshd.common.util.closeable.AbstractCloseable.doCloseImmediately(AbstractCloseable.java:157)
> at
> org.apache.sshd.common.util.closeable.AbstractInnerCloseable.access$001(AbstractInnerCloseable.java:28)
> at
> org.apache.sshd.common.util.closeable.AbstractInnerCloseable$1.operationComplete(AbstractInnerCloseable.java:51)
> at
> org.apache.sshd.common.util.closeable.AbstractInnerCloseable$1.operationComplete(AbstractInnerCloseable.java:47)
> at
> org.apache.sshd.common.future.AbstractSshFuture.notifyListener(AbstractSshFuture.java:165)
> at
> org.apache.sshd.common.future.DefaultSshFuture.addListener(DefaultSshFuture.java:159)
> at
> org.apache.sshd.common.util.closeable.AbstractInnerCloseable.doCloseImmediately(AbstractInnerCloseable.java:47)
> at
> org.apache.sshd.common.util.closeable.AbstractCloseable$1.operationComplete(AbstractCloseable.java:103)
> at
> org.apache.sshd.common.util.closeable.AbstractCloseable$1.operationComplete(AbstractCloseable.java:98)
> at
> org.apache.sshd.common.future.AbstractSshFuture.notifyListener(AbstractSshFuture.java:165)
> at
> org.apache.sshd.common.future.DefaultSshFuture.notifyListeners(DefaultSshFuture.java:202)
> at
> org.apache.sshd.common.future.DefaultSshFuture.setValue(DefaultSshFuture.java:104)
> at
> org.apache.sshd.common.future.DefaultCloseFuture.setClosed(DefaultCloseFuture.java:49)
> at
> org.apache.sshd.common.util.closeable.ParallelCloseable$1.operationComplete(ParallelCloseable.java:55)
> at
> org.apache.sshd.common.util.closeable.ParallelCloseable$1.operationComplete(ParallelCloseable.java:46)
> at
> org.apache.sshd.common.future.AbstractSshFuture.notifyListener(AbstractSshFuture.java:165)
> at
> org.apache.sshd.common.future.DefaultSshFuture.notifyListeners(DefaultSshFuture.java:202)
> at
> org.apache.sshd.common.future.DefaultSshFuture.setValue(DefaultSshFuture.java:104)
> at
> org.apache.sshd.common.future.DefaultCloseFuture.setClosed(DefaultCloseFuture.java:49)
> at
> org.apache.sshd.common.util.closeable.AbstractCloseable.doCloseImmediately(AbstractCloseable.java:157)
> at
> org.apache.sshd.common.util.closeable.AbstractInnerCloseable.access$001(AbstractInnerCloseable.java:28)
> at
> org.apache.sshd.common.util.closeable.AbstractInnerCloseable$1.operationComplete(AbstractInnerCloseable.java:51)
> at
> org.apache.sshd.common.util.closeable.AbstractInnerCloseable$1.operationComplete(AbstractInnerCloseable.java:47)
> at
> org.apache.sshd.common.future.AbstractSshFuture.notifyListener(AbstractSshFuture.java:165)
> at
> org.apache.sshd.common.future.DefaultSshFuture.addListener(DefaultSshFuture.java:159)
> at
> org.apache.sshd.common.util.closeable.AbstractInnerCloseable.doCloseImmediately(AbstractInnerCloseable.java:47)
> at
> org.apache.sshd.common.channel.AbstractChannel.doCloseImmediately(AbstractChannel.java:622)
> at
> org.apache.sshd.client.channel.ChannelSession.doCloseImmediately(ChannelSession.java:159)
> at
> org.apache.sshd.common.util.closeable.AbstractCloseable$1.operationComplete(AbstractCloseable.java:103)
> at
> org.apache.sshd.common.util.closeable.AbstractCloseable$1.operationComplete(AbstractCloseable.java:98)
> at
> org.apache.sshd.common.future.AbstractSshFuture.notifyListener(AbstractSshFuture.java:165)
> at
> org.apache.sshd.common.future.DefaultSshFuture.notifyListeners(DefaultSshFuture.java:202)
> at
> org.apache.sshd.common.future.DefaultSshFuture.setValue(DefaultSshFuture.java:104)
> at
> org.apache.sshd.common.future.DefaultCloseFuture.setClosed(DefaultCloseFuture.java:49)
> at
> org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:65)
> at
> org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:46)
> at
> org.apache.sshd.common.future.AbstractSshFuture.notifyListener(AbstractSshFuture.java:165)
> at
> org.apache.sshd.common.future.DefaultSshFuture.notifyListeners(DefaultSshFuture.java:202)
> at
> org.apache.sshd.common.future.DefaultSshFuture.setValue(DefaultSshFuture.java:104)
> at
> org.apache.sshd.common.future.DefaultCloseFuture.setClosed(DefaultCloseFuture.java:49)
> at
> org.apache.sshd.common.channel.AbstractChannel.handleClose(AbstractChannel.java:436)
> at
> org.apache.sshd.common.session.helpers.AbstractConnectionService.channelClose(AbstractConnectionService.java:425)
> at
> org.apache.sshd.common.session.helpers.AbstractConnectionService.process(AbstractConnectionService.java:308)
> at
> org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:530)
> at
> org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:463)
> - locked <0x00000007b4d27fd0> (a java.lang.Object)
> at
> org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1325)
> at
> org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:424)
> - locked <0x00000007b4fb9bd0> (a java.lang.Object)
> at
> org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:67)
> at
> org.apache.sshd.common.io.nio2.Nio2Session.handleReadCycleCompletion(Nio2Session.java:285)
> at
> org.apache.sshd.common.io.nio2.Nio2Session$2.onCompleted(Nio2Session.java:265)
> at
> org.apache.sshd.common.io.nio2.Nio2Session$2.onCompleted(Nio2Session.java:262)
> at
> org.apache.sshd.common.io.nio2.Nio2CompletionHandler$1.run(Nio2CompletionHandler.java:37)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.apache.sshd.common.io.nio2.Nio2CompletionHandler.completed(Nio2CompletionHandler.java:34)
> at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
> at sun.nio.ch.Invoker$2.run(Invoker.java:218)
> at
> sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> Locked ownable synchronizers:
> - <0x00000007b4d0d0f0> (a java.util.concurrent.ThreadPoolExecutor$Worker)
> I've only found a few references on such bug:
> https://github.com/functional-streams-for-scala/fs2/issues/275
> https://github.com/netty/netty/issues/852
> This is most likely a Darwin/NIO2 bug but I wanted to let you know about it
> and ask if you add an idea to work around this.
> Regards
> ================
> EDIT 1: It seems I can't comment on my own issue and so I can't answer to
> Lyor Goldstein's suggestion. :(
> We also tried with the Mina factory. Things are also very bad: the
> "sshd-SshClient[68d28c46]-mina-thread-XXX" threads spin infinitely and lock
> the cores they're running on. With mina 2.0.10, we don't get any log, but we
> do with 2.0.13, where we get flooded with the following log:
> "[info] 18:23:59.485 [WARN ] o.a.m.c.s.IoProcessor - Create a new selector.
> Selected is 0, delta = 0"
> With either factory, it seems sshd is broken on OSX. Even if it's not an
> issue in production, it really is on development where OSX is our main
> platform.
> Any help would be greatly appreciated, we'd rather not drop sshd for another
> library. We can help debugging and testing, please advice.
> ====
> EDIT 2: It seems we're hitting the same issue as described here:
> https://www.mail-archive.com/[email protected]/msg26557.html
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)