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

SSH Connection doesn't recover #7

Open
nikosch86 opened this issue May 16, 2021 · 1 comment
Open

SSH Connection doesn't recover #7

nikosch86 opened this issue May 16, 2021 · 1 comment

Comments

@nikosch86
Copy link

It looks like if the SSH Connection is interrupted it never recovers, the connections are still in the pool and lead to the following error.
In my case I have rsp running in a screen, similar to how I use autossh, which survives connectivity interruption as it just reconnects automatically.
I tried messing with the code to make rsp re-establish the SSH Connection if it catches the SSH connection closed exception, but I can't seem to make it work.

2021-05-16 07:16:35 INFO     SocksListener: Client ('127.0.0.1', 60386) connected
2021-05-16 07:16:35 INFO     SocksListener: Client ('127.0.0.1', 60386) requested connection to duckduckgo.com:443
2021-05-16 07:16:35 ERROR    SocksListener: Connection handler stopped with exception: SSH connection closed
Traceback (most recent call last):
  File "/home/wurzelsepp/.local/lib/python3.8/site-packages/rsp/sockslistener.py", line 157, in handler
    dst_reader, dst_writer = await asyncio.wait_for(
  File "/usr/lib/python3.8/asyncio/tasks.py", line 491, in wait_for
    return fut.result()
  File "/home/wurzelsepp/.local/lib/python3.8/site-packages/asyncssh/connection.py", line 3548, in open_connection
    chan, session = await self.create_connection(SSHTCPStreamSession,
  File "/home/wurzelsepp/.local/lib/python3.8/site-packages/asyncssh/connection.py", line 3520, in create_connection
    chan = self.create_tcp_channel(encoding, errors, window, max_pktsize)
  File "/home/wurzelsepp/.local/lib/python3.8/site-packages/asyncssh/connection.py", line 2287, in create_tcp_channel
    return SSHTCPChannel(self, self._loop, encoding,
  File "/home/wurzelsepp/.local/lib/python3.8/site-packages/asyncssh/channel.py", line 110, in __init__
    self._recv_chan = conn.add_channel(self)
  File "/home/wurzelsepp/.local/lib/python3.8/site-packages/asyncssh/connection.py", line 943, in add_channel
    raise ChannelOpenError(OPEN_CONNECT_FAILED,
asyncssh.misc.ChannelOpenError: SSH connection closed
2021-05-16 07:16:35 INFO     SocksListener: Client ('127.0.0.1', 60386) disconnected
@gitterspec
Copy link

Also trying to mess with this to add reconnection. Did you have any luck? Alternatively, I wonder if we could use a bash script, but this might have to test the connection periodically, adding overhead.

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

No branches or pull requests

2 participants