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

CheckKexes introduces large latency in session connections #765

Open
Alex-Vol-Amz opened this issue Feb 15, 2025 · 2 comments
Open

CheckKexes introduces large latency in session connections #765

Alex-Vol-Amz opened this issue Feb 15, 2025 · 2 comments

Comments

@Alex-Vol-Amz
Copy link
Contributor

After 0.2.16 when the [email protected] was introduced I noticed an 8 second latency in new sessions created during operation in an AWS Lambda environment. I have not pinpointed what part is really causing the latency but it is the doInit() calls for the KEX checking. The latest 0.2.23 version further increased the latency to 20 seconds per new session.

Removing the newer KEX from the list in CheckKexes drops the latency back to the normal levels.

Can the CheckKexes operation be optimized so the latency is a one time only event? Perhaps caching the result for future calls in the same JVM? I would like to see a better approach to this than having a slow connection for every new session.

@norrisjeremy
Copy link
Contributor

Hi @Alex-Vol-Amz,

You can adjust this to fit your own needs by changing the value of CheckKexes (via JSch.setConfig("CheckKexes", "...") or session.setConfig("CheckKexes", "...")) or by setting the system property value for jsch.check_kexes: just set it to reflect the set of algorithms you would like JSch to validate are usable.

Thanks,
Jeremy

@Alex-Vol-Amz
Copy link
Contributor Author

Sure, I already did that and it does address the issue sufficiently. I just think it needs to be at least documented since a lot of time sensitive consumers might be surprised and confused by this hidden latency. I have not analyzed what specifically is causing such a dramatic increase in observed latency when used in AWS Lambda environment but it is surely a show stopper for some applications.

My workaround for the specific use case as you suggested was to add in my application a static block to initialize to the algorithms available with the 0.2.15 version.

static {
    JSch.setConfig("CheckKexes", "curve25519-sha256,[email protected],curve448-sha512");
}

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