Closed netthier closed 1 year ago
bb8 can configure via https://docs.rs/bb8/0.8.0/bb8/struct.Builder.html#method.max_size .
e.g. let pool = bb8::Pool::builder().max_size(10).build(mgr).await?;
That's the limit on all active connections though. The issue is that servers like sshd only limit the number of maximum unauthenticated connections: https://stackoverflow.com/a/63174013 Because authentication doesn't happen in exactly the same moment as connection, the limit of unauthenticated connections can be reached by just opening multiple sessions at once. I want to be able to have theoretically infinite authenticated sessions, but limit the amount of currently handshaking ones.
Oh, I see. I will think about it.
@netthier We can continue discuss https://github.com/bk-rs/ssh-rs/pull/34 in here.
By default, the sshd server limits the maximum amount of open, unauthenticated sessions (
MaxStartups
). If many new SSH connections are opened simultaneously via bb8, that limit can be reached and will result in connection failures. As far as I know, there is no such limit for authenticated sessions. By limiting the amount of concurrentconnect
calls (e.g. via a Semaphore), this issue should be solveable.