sftp.get may fail on rekey of server
- Dominant language
- Java
- Stars
- 2.7k
- Forks
- 620
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 11
Description
``` java
SSHClient client = impl.createClient();
SFTPClient sftp = client.newSFTPClient();
sftp.get(fileName, new FileSystemFile(new File(testDest )));
```
If the fileName is a hugeFile (over 2G), and the server submits a 'rekey' operation, this gets fails with the following logging:
```
INFO net.schmizz.sshj.transport.random.BouncyCastleRandom..48 Generating random seed from SecureRandom.
INFO nl.vpro.nep.service.impl.SSHClientFactory.lambda$create$0.49 Validating sftp-itemizer.nepworldwide.nl with fingerprint 94:06:26:d5:e4:f5:18:b5:52:a9:19:b1:97:db:94:9e
INFO net.schmizz.sshj.transport.TransportImpl.sendClientIdent.214 Client identity string: SSH-2.0-SSHJ_0.24.0
INFO net.schmizz.sshj.transport.TransportImpl.init.178 Server identity string: SSH-2.0-Please re-connect using SFTP
INFO net.schmizz.sshj.connection.channel.direct.SessionChannel.startSubsystem.187 Will request `sftp` subsystem
RROR net.schmizz.sshj.transport.TransportImpl.die.593 Dying because - Broken transport; encountered EOF
net.schmizz.sshj.transport.TransportException: Broken transport; encountered EOF
at net.schmizz.sshj.transport.Reader.run(Reader.java:57)
INFO net.schmizz.sshj.transport.TransportImpl.notifyDisconnect.192 Disconnected - UNKNOWN
RROR net.schmizz.concurrent.Promise.tryRetrieve.174 <> woke to: net.schmizz.sshj.sftp.SFTPException: Broken transport; encountered EOF
net.schmizz.sshj.transport.TransportException: Socket closed
at net.schmizz.sshj.transport.TransportImpl.write(TransportImpl.java:454)
at net.schmizz.sshj.connection.channel.ChannelOutputStream$DataBuffer.flush(ChannelOutputStream.java:102)
at net.schmizz.sshj.connection.channel.ChannelOutputStream$DataBuffer.flush(ChannelOutputStream.java:70)
at net.schmizz.sshj.connection.channel.ChannelOutputStream.flush(ChannelOutputStream.java:182)
at net.schmizz.sshj.sftp.SFTPEngine.transmit(SFTPEngine.java:297)
at net.schmizz.sshj.sftp.SFTPEngine.request(SFTPEngine.java:130)
at net.schmizz.sshj.sftp.RemoteResource.close(RemoteResource.java:53)
at net.schmizz.sshj.sftp.SFTPFileTransfer$Downloader.downloadFile(SFTPFileTransfer.java:149)
at net.schmizz.sshj.sftp.SFTPFileTransfer$Downloader.download(SFTPFileTransfer.java:105)
at net.schmizz.sshj.sftp.SFTPFileTransfer$Downloader.access$300(SFTPFileTransfer.java:90)
at net.schmizz.sshj.sftp.SFTPFileTransfer.download(SFTPFileTransfer.java:71)
at net.schmizz.sshj.sftp.SFTPClient.get(SFTPClient.java:239)
at nl.vpro.nep.service.impl.NEPSSHJDownloadServiceImplTest.testSshj(NEPSSHJDownloadServiceImplTest.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.net.SocketException: Socket closed
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:118)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at net.schmizz.sshj.transport.TransportImpl.write(TransportImpl.java:451)
... 35 more
```
With older scp (command line clients) this goes wrong in a similar manner, but newer ones work ok. After some investigation we concluded that this rekeying could be the cause (I had never heard of it).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.