-
Notifications
You must be signed in to change notification settings - Fork 185
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 tunnels stop working after some time #261
Comments
did you tried the keepalive parameter? |
@lucasgherculano Do you mean SSH client or server? Tried adding SSH bastion server parameters, but need time to test if it helped:
I thought sshtunnel should implement keepalive on its side. |
keepalive didn't work |
Manually creating SSH tunnel with "ssh" command works ok |
@f1nality also encountering this. Did you ever find a solution? |
Hi @f1nality , any idea how you fixed this? |
@lucaslcode @matthew-k2001 I've switched to using "ssh" command to create tunnels in the end :( |
Thanks @f1nality for the quick reply, could you elaborate what you mean? |
@matthew-k2001 i'm using subprocess.Popen to run command "ssh -N ...". You can check source code here: |
Thanks @f1nality, my knowlegde might be lacking here so could you clarify why does that keep the connection. Is it similar to AutoSSH? |
@matthew-k2001 this library sshtunnel implements SSH using paramiko and TCP sockets, "ssh" command is a much more widely used utility in linux distributives which has its own implementation. So it is actually different code, making the same. But looks like sshtunnel or paramiko (less likely) has some bug with keeping connections alive, but "ssh" command does not have this bug. |
Thanks @f1nality that makes sense! |
I faced strange behavior. I'm using the following code to set up SSH tunnels to connect to PostgreSQL
When connection is made everything works ok, but after some time (~10 hours) i'm getting PSQL error:
netstat -lntu
shows opened ports, but makingtelnet
returns error.All new SSH tunnels started afterwards - also returns errors right after start (and somehow they create two open ports).
Only application restart solves the problem.
Starting SSH tunnel manually through
ssh -L localhost:1111:DB_HOST:DB_PORT -i KEY BASTION_USER@BASTION_HOST
works fine, such tunnels work and don't returntelnet
error.The text was updated successfully, but these errors were encountered: