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

implement limit connections #1527

Merged
merged 6 commits into from
Jan 21, 2025

Conversation

SimoneDutto
Copy link
Contributor

Description

This is an implementation of the MaxConcurrentRequest for the ssh server.
The implementation is a copy/paste of https://cs.opensource.google/go/x/net/+/refs/tags/v0.34.0:netutil/listen.go with an additional timeout.
In fact the LimitListener hangs forever the Accept() until a seat is made available, making it hard to test and also counter intuitive, because we want to close connection when we reach the limit.

The error from the SSH client is:
image

Note

This is the first simple implementation until we get a better way of doing it by interacting with the gliderlab/ssh server. I am working on a issue + pr to make it possible.

Engineering checklist

  • Documentation updated
  • Covered by unit tests
  • Covered by integration tests

Test instructions

@SimoneDutto SimoneDutto requested a review from a team as a code owner January 17, 2025 14:23
internal/ssh/listener.go Outdated Show resolved Hide resolved
internal/ssh/ssh.go Show resolved Hide resolved
internal/ssh/ssh.go Outdated Show resolved Hide resolved
internal/ssh/ssh_test.go Outdated Show resolved Hide resolved
@SimoneDutto SimoneDutto requested a review from kian99 January 20, 2025 08:00
internal/ssh/ssh.go Outdated Show resolved Hide resolved
internal/ssh/ssh.go Outdated Show resolved Hide resolved
@SimoneDutto SimoneDutto force-pushed the implement-limit-connections branch from 370a931 to f845686 Compare January 21, 2025 07:57
@SimoneDutto SimoneDutto force-pushed the implement-limit-connections branch from f845686 to 547dc90 Compare January 21, 2025 07:57
internal/ssh/listener.go Show resolved Hide resolved
internal/ssh/listener.go Show resolved Hide resolved
internal/ssh/listener.go Show resolved Hide resolved
internal/ssh/listener.go Show resolved Hide resolved
internal/ssh/listener.go Show resolved Hide resolved
internal/ssh/listener.go Outdated Show resolved Hide resolved
internal/ssh/ssh.go Show resolved Hide resolved
internal/ssh/ssh.go Outdated Show resolved Hide resolved
internal/ssh/ssh.go Show resolved Hide resolved
internal/ssh/ssh.go Outdated Show resolved Hide resolved
internal/ssh/ssh.go Outdated Show resolved Hide resolved
internal/ssh/listener.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@alesstimec alesstimec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with one final suggestion

internal/ssh/ssh.go Outdated Show resolved Hide resolved
@SimoneDutto SimoneDutto merged commit 8de5428 into canonical:v3 Jan 21, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

3 participants