Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Missing file segements in upload" error when using Fast Put #171

Open
scooper91 opened this issue Mar 29, 2021 · 5 comments
Open

"Missing file segements in upload" error when using Fast Put #171

scooper91 opened this issue Mar 29, 2021 · 5 comments

Comments

@scooper91
Copy link

scooper91 commented Mar 29, 2021

Hi,

We're frequently seeing a Missing file segements in upload:0 error when trying to upload a file to a client's SFTP. It's a large file - ~1GB. The upload is successful and complete (we've verified the checksum), so we're unsure why we're seeing this error. We seeing this error about 80% of the time.

We found this issue on the library we're using. We also tried using a different library (which still uses this ssh2-streams library), but got the same error. We are able to successfully upload a file using scp.

We enabled debug mode, but nothing really jumped out. We did notice a 2 second pause between the last debug log and when the error was thrown.

Here's a screenshot of when the error was thrown:

image (9)

We're not sure whether this is a problem with the SFTP server, or an issue at our end.

Any advice would be greatly appreciated.

Thanks!

@mscdex
Copy link
Owner

mscdex commented Mar 29, 2021

That error is not coming from this module, so I can't help you there. You'll need to take it up with ssh2-sftp-client it seems.

@scooper91
Copy link
Author

Thanks for the reply.

The error is surfacing through the ssh2-sftp-client, but at the bottom of the stack, the error is coming from ssh2-streams. In the linked issue from the ssh2-sftp-client, the maintainer says it's not to do with their library. As I mentioned, we got the same error (with the stack originating from this ssh2-streams library) using a different library.

It looks like the ssh2-sftp-client library is calling fastPut in this library, and the error in the stack trace is just a formatted version of the underlying error from ssh2-streams.

Thanks!

@mscdex
Copy link
Owner

mscdex commented Mar 30, 2021

Then I can only guess it's coming from the server because this module has never had an error message like that before. Is this a custom/specialty/uncommon sftp/ssh server?

@scooper91 scooper91 changed the title "Missing file segements in upload" error even though upload is complete "Missing file segements in upload" error when using Fast Put Apr 7, 2021
@scooper91
Copy link
Author

It appears that we weren't doing a diligent enough check to ensure the files were uploading correctly. The file size is always correct when uploading the files, even when we get the error, but the start of the file is corrupted. We get a bunch of null characters (which show as ^@ in Vim), which represents zero-bytes.

e.g. When opening one of the files in Vim, it looks something like this (but with a lot more zero-byte characters)

@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@rest-of-the-data

Unfortunately, it's a third-party SFTP, which we're just integrating with, so we don't know much about it! We do not appear to have an issue when using SCP to upload files, and the owner of the SFTP has used FileZilla without any issues (although I don't know if they upload the file chunks concurrently).

@mscdex
Copy link
Owner

mscdex commented Apr 7, 2021

Does the upload work when using sftp.createWriteStream() instead? That function does not send concurrent chunks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants