"SFTPException: EOF while reading packet" when attempting to overwrite large SFTP Files
- Dominant language
- Java
- Stars
- 2.7k
- Forks
- 620
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 11
Description
Hi,
When overwriting large files (around 10MB+) - I have been encountering an issue using RemoteFile.write() to overwrite a file in 8192 chunks, it throws an "SFTPException: EOF while reading packet".
It typically lasts for a large iteration of writes to the file (i.e. in my most recent test it failed on Request{27;WRITE}), is there a known issue causing an interaction like this or some setting that needs to be enforced when writing large files? As this issue is not present when the file is originally copied onto the SFTP Server.
Below are some log lines around the time of the error occurring.
```
2018-10-08 15:07:45,438 [Finalizer] DEBUG net.schmizz.sshj.connection.channel.direct.SessionChannel - Sending close
2018-10-08 15:07:45,438 [MyThread] DEBUG net.schmizz.sshj.connection.channel.Window$Remote - Consuming by 8221 down to 2014942
2018-10-08 15:07:45,438 [MyThread] DEBUG net.schmizz.concurrent.Promise - Awaiting <>
2018-10-08 15:07:45,438 [Finalizer] TRACE net.schmizz.sshj.transport.Encoder - Encoding packet #34: 61 00 00 00 00
2018-10-08 15:07:45,438 [Finalizer] DEBUG net.schmizz.concurrent.Promise - Awaiting <>
2018-10-08 15:07:45,438 [reader] TRACE net.schmizz.sshj.transport.Decoder - Received packet #36: 62 00 00 00 00 00 00 00 0b 65 78 69 74 2d 73 74 61 74 75 73 00 00 00 00 00
2018-10-08 15:07:45,438 [reader] TRACE net.schmizz.sshj.transport.TransportImpl - Received packet CHANNEL_REQUEST
2018-10-08 15:07:45,438 [reader] DEBUG net.schmizz.sshj.connection.channel.direct.SessionChannel - Got chan request for 'exit-status'
2018-10-08 15:07:45,438 [reader] TRACE net.schmizz.sshj.transport.Decoder - Received packet #37: 61 00 00 00 00
2018-10-08 15:07:45,438 [reader] TRACE net.schmizz.sshj.transport.TransportImpl - Received packet CHANNEL_CLOSE
2018-10-08 15:07:45,438 [reader] DEBUG net.schmizz.sshj.connection.channel.direct.SessionChannel - Got close
2018-10-08 15:07:45,453 [reader] DEBUG net.schmizz.sshj.connection.ConnectionImpl - Forgetting 'session' channel (#0)
2018-10-08 15:07:45,453 [reader] DEBUG net.schmizz.concurrent.Promise - Setting <> to 'SOME'
2018-10-08 15:07:45,453 [Finalizer] INFO net.schmizz.sshj.transport.TransportImpl - Disconnected - BY_APPLICATION
2018-10-08 15:07:45,453 [MyThread] ERROR net.schmizz.concurrent.Promise - <> woke to: net.schmizz.sshj.sftp.SFTPException: EOF while reading packet
2018-10-08 15:07:45,453 [Finalizer] DEBUG net.schmizz.sshj.connection.ConnectionImpl - Notified of net.schmizz.sshj.transport.TransportException: [BY_APPLICATION] Disconnected
```
The messages when writing are the following (shortened Encoding packet line for readability due to being very large):
```
2018-10-08 15:07:45,281 [sftp reader] DEBUG net.schmizz.concurrent.Promise - Setting <> to 'Buffer [rpos=5, wpos=521, size=521]'
2018-10-08 15:07:45,281 [MyThread] DEBUG net.schmizz.sshj.sftp.SFTPEngine - Sending Request{5;WRITE}
2018-10-08 15:07:45,281 [MyThread] TRACE net.schmizz.sshj.transport.Encoder - Encoding packet #11: 5e 00 00 00 00 00 00 0e 97 00 00 0e 93 06 00 00 00 05 00 00 00 04 00 00 00 00 00 00 00 00 00 00 02 00 00 00 0e 7a 78 78 78 78 78 78 78 78 78 78 78 78 78 78 ... 78
2018-10-08 15:07:45,281 [MyThread] DEBUG net.schmizz.sshj.connection.channel.Window$Remote - Consuming by 3735 down to 2093259
2018-10-08 15:07:45,281 [MyThread] DEBUG net.schmizz.concurrent.Promise - Awaiting <>
2018-10-08 15:07:45,281 [reader] TRACE net.schmizz.sshj.transport.Decoder - Received packet #13: 5e 00 00 00 00 00 00 00 1c 00 00 00 18 65 00 00 00 05 00 00 00 00 00 00 00 07 53 75 63 63 65 73 73 00 00 00 00
2018-10-08 15:07:45,297 [reader] TRACE net.schmizz.sshj.transport.TransportImpl - Received packet CHANNEL_DATA
2018-10-08 15:07:45,297 [reader] TRACE net.schmizz.sshj.connection.channel.direct.SessionChannel - IN #0: 00 00 00 18 65 00 00 00 05 00 00 00 00 00 00 00 07 53 75 63 63 65 73 73 00 00 00 00
2018-10-08 15:07:45,297 [reader] DEBUG net.schmizz.sshj.connection.channel.Window$Local - Consuming by 28 down to 2095378
2018-10-08 15:07:45,297 [sftp reader] DEBUG net.schmizz.sshj.sftp.PacketReader - Received STATUS packet
2018-10-08 15:07:45,297 [sftp reader] DEBUG net.schmizz.concurrent.Promise - Setting <> to 'Buffer [rpos=5, wpos=24, size=24]'
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.