-
Notifications
You must be signed in to change notification settings - Fork 672
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
When updating from version 0.8.9 to 1.1.0 connections takes 10 times longer to establish (with ssh2-sftp-client) #1031
Comments
If you're using different node versions, it could be due to changes made awhile back in node's OpenSSL to improve security with traditional diffie-hellman key exchanges. I believe you shouldn't see this slowdown on servers that can utilize curve25519 key exchanges though. |
No, both ssh2 (in fact ssh2-sftp-client) codes are running on the same node version. I've try both ssh2-sftp-client versions on these environments (without changing node version):
|
I'm not sure why there would be any difference then. The exact same crypto API is being used for doing key exchanges. |
OK, so I will look further on ssh2-sftp-client side. |
It's not a ssh2-sftp-client problem. For my test I used the following script: let { Client } = require('ssh2')
let prettyTime = require('pretty-time')
let client = new Client()
let startTime = process.hrtime()
client.on('ready', () => {
console.log(`Connection time: ${prettyTime(process.hrtime(startTime), 'ms')}`)
client.sftp((err, sftp) => {
if (err) console.error(err)
sftp.stat('.', (err, stats) => {
if (err) console.error(err)
console.log(stats)
client.end()
})
})
}).on('close', () => {
console.log(`Total execution time: ${prettyTime(process.hrtime(startTime), 'ms')}`)
}).connect({
host: 'xxx.yyy.zzz',
username: 'user',
password: 'pass',
readyTimeout: 100000,
debug: console.log
}) With ssh2 0.8.9 (node 14.17.0, Windows 10) connection in 3s 74ms and total execution in 3s 148ms.
With ssh2 1.1.0 (node 14.17.0, Windows 10) connection in 23s 34ms and total execution in 23s 101ms.
The waiting time take place after |
Ok there are a couple of issues at play here:
Even after fixing issue 1, issue 2 could still cause larger prime numbers to be requested from the server, depending on the negotiated algorithms. However in some cases it can also cause smaller prime numbers to be requested than in |
Let me know how the master branch fares for you. |
Excellent job! 🚀 Here is the result with ssh2 6d8692d (node 14.17.0, Windows 10) connection in 1s 538ms and total execution in 1s 594ms.
Thank you very much! |
May be related to #927 & #1010. Ticket at ssh2-sftp-client.
Version 0.8.9 of ssh2 (ssh2-sftp-client 6.0.1) takes 3 seconds after
DEBUG: Parser: IN_PACKETDATAAFTER, packet: KEXDH_GEX_GROUP
.Debug version ssh2-sftp-client 6.0.1 (ssh2 0.8.9, node 14)…
Version 1.1.0 of ssh2 (ssh2-sftp-client 7.0.0) takes 30 seconds (have to set
readyTimeout
) afterReceived DH GEX Group
.Debug version ssh2-sftp-client 7.0.0 (ssh2 1.1.0, node 14)…
The text was updated successfully, but these errors were encountered: