Is there a limit to how many channels can be open per session in JSch?
Is there a limit to how many channels can be open per session in JSch ? The cannels I am trying to open are of type "ChannelShell"
I get an "com.jcraft.jsch.JSchException: channel 开发者_如何学运维is not opened." exception when I try to open the eleventh channel i.e. channel[10] Does this mean that I can have up to 10 channels per session?
P.S. I dont understand how to meet stackoverflow's quality standards.
OpenSSH's sshd had such a restriction to allow only 10 channels simultaneously, and recent its sshd has introduced the flag 'MaxSession' to sshd_config.
Refer to "man sshd_config",
MaxSessions
Specifies the maximum number of open sessions permitted per net-
work connection. The default is 10.
There should not be a limit (other then by the available memory/thread count in your VM, Integer.MAX_VALUE and what the server supports).
I think I've seen a similar error lately (with a single channel, though) - the reason was some race condition, and it was solved in the latest version (0.1.45-RC4, linked from the mailing list).
Try replacing your jsch.jar with the latest one, and check if the problem still appears. (It looks like 0.1.45-RC5 is the latest.) If it still occurs, try to create a minimal example so we can reproduce it.
精彩评论