xebialabs / overthere

Runs something "Over there"

Home Page:http://www.xebialabs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WinSSHD has a race condition with sending/receiving ident

hierynomus opened this issue · comments

Sometimes SSHJ will be faster in sending its client ident than the WinSSHD server is with sending its ident. This will result in the WinSSHD server to start sending a protocol message without first sending its own ident. The result of this is that SSHJ is not expecting the protocol message, because it is still waiting for the server ident (see hierynomus/sshj#118)

The stacktrace that you get is then:

Caused by: net.schmizz.sshj.transport.TransportException: Incorrect identification: line too long
at net.schmizz.sshj.transport.TransportImpl.init(TransportImpl.java:164)
at net.schmizz.sshj.SSHClient.onConnect(SSHClient.java:671)
at net.schmizz.sshj.SocketClient.connect(SocketClient.java:71)
at net.schmizz.sshj.SocketClient.connect(SocketClient.java:77)
at net.schmizz.sshj.SocketClient.connect(SocketClient.java:103)
at com.omneon.dam.util.bitspeed.BitSpeedUtil.openConnection(BitSpeedUtil.java:370)
at com.omneon.dam.util.bitspeed.BitSpeedUtil.exists(BitSpeedUtil.java:303)
... 19 more

Since hierynomus/sshj 0.16.0 this can be resolved by setting the Config.setWaitForServerIdentBeforeSendingClientIdent(true) configuration setting in case we are connecting to a WinSSHD box.