java.io.IOException: The specified network name is no longer available
問題
atlassian-stash.log
に次のメッセージが出力される。
2014-11-24 15:12:30,921 WARN [pool-11-thread-2] o.a.sshd.common.io.nio2.Nio2Acceptor Caught exception while accepting incoming connection
java.io.IOException: The specified network name is no longer available.
at sun.nio.ch.Iocp.translateErrorToIOException(Iocp.java:309) ~[na:1.7.0_51]
at sun.nio.ch.Iocp.access$700(Iocp.java:46) ~[na:1.7.0_51]
at sun.nio.ch.Iocp$EventHandlerTask.run(Iocp.java:399) ~[na:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51]
Once that happens, Stash 3.1.0 and 3.1.1 stop accepting SSH connections. You will need to disable/enable your SSH server using the Stash UI just as described on Enabling SSH access to Git repositories in Stash.
原因
Stash 3.1.0 and 3.1.1 shipped with an upgrade to the Apache Mina SSHD library Atlassian uses to provide SSH hosting functionality. We ran into issues with that upgrade internally (not the same issue as described here; we found a memory leak with SSH sessions that eventually leads to GC paralysis) and so Stash 3.1.3 reverted that upgrade and returned to the version of the library we shipped in Stash 3.0 and prior.
Mina SSHD has multiple strategies for handling sockets. As part of the library upgrade in Stash 3.1.0, our configuration switched from one strategy (using Java NIO) to a different strategy that uses NIO2. After looking at the implementations of these two strategies, the Nio2Acceptor (which is in use here, as seen from the logs) stops accepting new connections the first time there's an error. The strategy using NIO does not stop accepting connections on errors. Instead, it sleeps briefly (to give the issue time to resolve itself, assuming it's a transient network issue) and then resumes accepting connections. As part of the library revert in 3.1.3 we switched back to the NIO-based implementation.
ソリューション
Stash 3.1.0 and Stash 3.1.1 are the only versions of Stash vulnerable to the issue you're experiencing. Upgrading Stash should mean your instance automatically recovers after these errors, rather than requiring SSH to be restarted.