选择:ssh localforward上的无效参数

时间:2018-12-07 08:10:47

标签: ssh python-requests python-asyncio file-descriptor ssh-tunnel

我有一个配置文件,具有如下的localforward设置

LocalForward 8443 remoteserver.com:8443

在以调试模式将其ssh并开始向远程服务器发送许多请求之后,我看到以下几行

debug1: channel 1017: new [direct-tcpip]
debug1: channel 0: free: port listener, nchannels 1018
debug1: channel 1: free: port listener, nchannels 1017
debug1: channel 2: free: port listener, nchannels 1016
debug1: channel 3: free: port listener, nchannels 1015
debug1: channel 4: free: port listener, nchannels 1014
debug1: channel 5: free: port listener, nchannels 1013
debug1: channel 6: free: port listener, nchannels 1012
debug1: channel 7: free: port listener, nchannels 1011
debug1: channel 8: free: direct-tcpip: listening port 8443 for remotserver.com port 8443, connect from 127.0.0.1 port 49991 to 127.0.0.1 port 8443, nchannels 1010
debug1: channel 9: free: direct-tcpip: listening port 8443 for remoteserver.com port 8443, connect from 127.0.0.1 port 49992 to 127.0.0.1 port 8443, nchannels 1009
.
.

debug1: channel 1016: free: direct-tcpip: listening port 8443 for remoteserver.com port 8443, connect from 127.0.0.1 port 51113 to 127.0.0.1 port 8443, nchannels 2
debug1: channel 1017: free: direct-tcpip: listening port 8443 for remoteserver.com port 8443, connect from 127.0.0.1 port 51114 to 127.0.0.1 port 8443, nchannels 1
select: Invalid argument

,并且SSH使用“ select:Invalid arguments”(选择:无效参数)中断/退出。我可以看到nchannels减少到1,并且它不能再增加任何通道。下面是我机器中“ ulimit -aH”的输出。

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 524288
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 2048
virtual memory          (kbytes, -v) unlimited

我是否可以知道将通道数限制设置为〜1024左右的配置,以及如何增加它以异步方式从我的计算机发送10000+个请求。

这是发送这些请求的python代码

async def async_fun(self, loop):
    for record in enumerate(record_list): #10000+ records 
        task = loop.run_in_executor(
                concurrent.futures.ThreadPoolExecutor(max_workers=3),
                self._fun,
                record,
                )
        futures.append(task)

    await asyncio.gather(*futures, return_exceptions=True)

0 个答案:

没有答案