You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When there are no longer any references the the gateway ssh session but there are to the remote session, the gateway session gets garbage collected too early, resulting in remote sessions failing with the following error:
paramiko.ssh_exception.SSHException: SSH session not active
Here's some code to re-create the issue:
importosfromjumpsshimportSSHSessiondefget_remote_session():
user=os.getlogin()
gateway_session=SSHSession(
host="127.0.0.1",
username=user,
).open()
remote_session=gateway_session.get_remote_session(
host="127.0.0.2",
username=user,
)
returnremote_session# gateway ssh gets garbage collected here, which closes the gateway transport still needed by the remote sessionif__name__=="__main__":
withget_remote_session() asremote_session:
remote_session.get_sftp_client().get(
".bashrc",
f"{os.path.expanduser('~')}\\Documents\\bashrc.txt"
)
Which results in:
paramiko.ssh_exception.SSHException: SSH session not active
One possible fix which I've tested as working would be to add a reference to the gateway SSH session inside the jumpssh.SSHSession class. What do you think?
The text was updated successfully, but these errors were encountered:
When there are no longer any references the the gateway ssh session but there are to the remote session, the gateway session gets garbage collected too early, resulting in remote sessions failing with the following error:
paramiko.ssh_exception.SSHException: SSH session not active
Here's some code to re-create the issue:
Which results in:
paramiko.ssh_exception.SSHException: SSH session not active
One possible fix which I've tested as working would be to add a reference to the gateway SSH session inside the
jumpssh.SSHSession
class. What do you think?The text was updated successfully, but these errors were encountered: