title: select: Invalid argument on ssh localforward
body: <p>I have a config file with localforward settings as below</p>
  
  <p>LocalForward 8443 remoteserver.com:8443</p>
  
  <p>After I ssh into it in debug mode and start sending many requests to remote server, I see the below lines</p>
  
  <pre><code>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
  </code></pre>
  
  <p>and the SSH breaks/exits with 'select: Invalid argument'. I could see the nchannels decreased till 1 and it failed to make any more channels. Below is the output of 'ulimit -aH' in my machine.</p>
  
  <pre><code>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
  </code></pre>
  
  <p>May I know what configuration that sets the number of channels limit to ~1024 or so and how can I increase it to send 10000+ requests from my machine asynchronously.</p>
  
  <p>Here's the python code to send these requests</p>
  
  <pre><code>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)
  </code></pre>