YannickB / odoo-hosting

Other
64 stars 50 forks source link

[BUG] Stale SSH connection on remote server reboot #152

Closed lasley closed 7 years ago

lasley commented 7 years ago

If the remote server is rebooted, the Clouder host server requires a restart to clear the stale connection in global memory.

  File "/media/psf/LasLabs Inc/Repos/clouder/clouder/model.py", line 607, in execute
    channel = transport.open_session()
  File "/var/www/odoo/_venv/local/lib/python2.7/site-packages/paramiko/transport.py", line 705, in open_session
    timeout=timeout)
  File "/var/www/odoo/_venv/local/lib/python2.7/site-packages/paramiko/transport.py", line 789, in open_channel
    raise SSHException('SSH session not active')
SSHException: SSH session not active

Interesting thing is that the "Test Connection" button says that the connection is a success, so I think this might be broken

YannickB commented 7 years ago

Yeah I know this problem really well, it's definitely time to fix it. When we execute a command, a connection is done through this function : https://github.com/clouder-community/clouder/blob/0.9.0/clouder/model.py#L436, and then stored in global variable so we don't have to connect again.

But if this connection expire on the target side (server reboot for instance), Clouder still consider this connection active and then trigger this error. We need to catch it and make another connection in this case.

lasley commented 7 years ago

FYI I'm about halfway done with a fix, just working on the connection recursion. I was also able to replicate this with SSH timeout being set on the remote end.

lasley commented 7 years ago

Completed with #154