-
Notifications
You must be signed in to change notification settings - Fork 205
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
[SOLVED] put hangs on bigger files to certain hostings #342
Comments
It shouldn't just hang - log shows you are being sent a rejected
promise. I suspect your code is not handling the put() promise
correctly. Can you create a minimal example which reproduces the issue
and send the code.
BTW node v15.4 is an old development version - really should be using a
release version or at least the latest in that development series (i.e.
15.14.0 or better 16.6.2 - especially given important security
vulnerabilities were recently fixed in all node versions from v12 - v16.
Ladislav Jacho ***@***.***> writes:
… If I am trying to upload small file colors.js everything works like a breeze. As soon as I want to do the same with main.js. Put
hangs.
-rw-rw-r-- 1 sbtge sbtge 167 Aug 15 22:42 colors.js
-rw-rw-rw- 1 sbtge sbtge 11833 Aug 15 22:49 main.js
Here is the log.
[2021-08-15T22:49:10.698] INFO: 🔼 [SFTPClient] uploading main.js
[2021-08-15T22:49:10.698] CLIENT[sftp]: put: Adding temp event listeners
[2021-08-15T22:49:10.699] Outbound: Sending CHANNEL_DATA (r:0, 63)
[2021-08-15T22:49:10.699] SFTP: Outbound: Buffered OPEN
[2021-08-15T22:49:10.699] CLIENT[sftp]: put source is a stream
[2021-08-15T22:49:10.731] Inbound: CHANNEL_DATA (r:0, 17)
[2021-08-15T22:49:10.732] SFTP: Inbound: Received HANDLE (id:0)
[2021-08-15T22:49:10.732] Outbound: Sending CHANNEL_DATA (r:0, 25)
[2021-08-15T22:49:10.732] SFTP: Outbound: Buffered FSETSTAT
[2021-08-15T22:49:10.765] Inbound: CHANNEL_DATA (r:0, 28)
[2021-08-15T22:49:10.765] SFTP: Inbound: Received STATUS (id:1, 0, "Success")
[2021-08-15T22:49:10.766] Outbound: Sending CHANNEL_DATA (r:0, 7320)
[2021-08-15T22:49:10.766] SFTP: Outbound: Sent WRITE (id:2)
[2021-08-15T22:49:12.645] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:14.645] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:16.645] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:18.646] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:20.647] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:22.647] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:24.647] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:26.648] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:28.648] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:30.648] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:32.649] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:34.649] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:36.649] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:38.650] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:40.650] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:42.650] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:44.650] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:46.650] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:48.650] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:50.651] Outbound: Sending ping (GLOBAL_REQUEST: ***@***.***)
[2021-08-15T22:49:52.652] CLIENT[sftp]: put: Handling error: Keepalive timeout
[2021-08-15T22:49:52.652] CLIENT[sftp]: put: handled error with reject
[2021-08-15T22:49:52.652] CLIENT[sftp]: Global: Ignoring handled error
[2021-08-15T22:49:52.652] CLIENT[sftp]: put: Removing temp event listeners
[2021-08-15T22:49:52.653] Error: put: Keepalive timeout
at fmtError (/home/sbtge/workspace/1-lab/ftp-syncer/dist/index.js:3767:22)
at Client.fn (/home/sbtge/workspace/1-lab/ftp-syncer/dist/index.js:3782:20)
at Client.emit (node:events:388:22)
at Timeout.sendKA (/home/sbtge/workspace/1-lab/ftp-syncer/node_modules/ssh2/lib/client.js:662:16)
at listOnTimeout (node:internal/timers:556:17)
at processTimers (node:internal/timers:499:7)
I am using ssh2-sftp-cllient: 7.0.1 and node v. 15.3.0.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Thank you for your quick answer. I changed the node to 16.6.2 as you advised. Problem persists. Here is a simplified version of the code:
Code is heavily inspired by your examples. Thank you for any help! |
UPDATE: I found out that files ~3.06 KiB and bigger are not uploading correctly. If I use a client e.g. Filezilla, all files are being uploaded without problems. |
What do you have in the 'options' and 'uploadOptions' objects? (I don't
need password/username/host, just the other settings).
What platform is the client running on and do you know what platform the
remote sftp server is running on?
|
and
sftp server is running on godaddy - I dont know what platform are they using. IMPORTANT: I found out that it is not working in WSL2 but on mac x64 it works with bigger files! Do you have an idea where could be the problem? |
This is not an issue I am able to reproduce with any of my test servers.
My tests include transfer of files in sizes up to 1Gb and include file
checksums to verify the data is being transferred correctly.
This indicates it is either an issue local to your network or some
special edge case associated with the sftp server you are attempting to
upload to. I have seen similar problems when going through a deep packet
inspection firewall (such as Palo Alto firewalls). With such firewalls,
it takes a few data packets before the firewall has sufficient data to
inspect and make a call regarding whether to permit the traffic to
continue. When the firewall decides to block the data, it tends to just
drop it and not report any errors (because it doesn't want to give any
hints/information to potentially malicious users).
This isn't to say this is your problem, but merely an example of the
types of problems you can encounter. It can be difficult to diagnose
because other sftp programs will work (the Palo Alto works based on
traffic signatures and different software exhibits different
signatures). In one case I had, I could only get the data uploaded if I
explicitly told the remote sftp server not to use compression. The
firewall allowed uncompressed packets through, but not compressed ones.
I had to wait until the network admins updated the firewall signatures
before I was able to use compression.
One thing you could try is uploading to an sftp server which is on your
local network (and presumably does not need to go through any
firewalls) and see if you observe the same issue.
The other thing you will need to do if you cannot isolate the issue is
write a simple script using just the ssh2 module and verify the issue
with just that. If it still exists, you will need to log an issue with
the ssh2 maintainers. The ssh2-sftp-client is really just a wrapper
around the ssh2 module, providing a more abstracted and promise based
API. If there is an issue with how it is processing the data upload,
there is little I can do form the ssh2-sftp-client layer. There are
sample scripts in the validation directory which you can use as a
template.
If you right a script which only uses ssh2 and it works, then please let
me know as that would indicate the issue is in the ssh2-sftp-layer.
However, this is unlikely (you would be the first to find such an issue :-;)
|
thank you for deeper explanation! I will try to continue with this for a bit ;) |
No idea. I wouldn't be surprised if it wasn't something particular to
the network stack and WSL. I'd install node on native windows and see if
that works.
Note that I don't use windows. I do run the test suite on a windows 10
system and I do test against a Windows based sftp server, but I have
little experience with that platform.
My money would be that it is to do with the WSL layer - this is
effectively a virtual machine where they are doing some network bridging
across the main host network stack and that could introduce all sorts of
weirdness.
BTW I don't think you need the put options - they are effectively the
defaults anyway. Likewise with setting port as 22 is the default. In
general, I think it is better not to supply options unless you need to
change them from the default.
|
gotcha! look: I can upload
I can upload
even linux sftp CLI utility hangs with uploading we can close this as it's not the problem of ssh2-sftp-client at all |
definitely not a problem of ssh2-sftp-client I prepared answer for all people coming here.
source: snailbook.com temporary solution:
|
Thanks, I'll add it to the 'Troubleshooting' section of the README. In the 'old days', it was common to have to set an MTU of 1400 whenever you needed to interact with Windows/MS-DOS based systems. I had completely forgotten that as it has been some time since I've seen this issue.
|
If I am trying to upload small file
colors.js
everything works like a breeze. As soon as I want to do the same withmain.js
. Put hangs.Here is the log.
I am using
ssh2-sftp-cllient: 7.0.1
andnode v. 15.3.0
.The text was updated successfully, but these errors were encountered: