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 plugin breaks due to bug fixes in Paramiko #67

Open
dwalleck opened this issue Mar 14, 2018 · 0 comments
Open

SSH plugin breaks due to bug fixes in Paramiko #67

dwalleck opened this issue Mar 14, 2018 · 0 comments

Comments

@dwalleck
Copy link

dwalleck commented Mar 14, 2018

When executing tests that use the SSH plugin and the current version of Paramiko, an exception occurs due to a broken import:

Traceback (most recent call last):
  File "/home/dwalleck/opencafe_demo/cafe_env/local/lib/python2.7/site-packages/cloudroast/compute/instance_actions/api/test_create_server.py", line 342, in test_personality_file_created
    self.server, self.servers_config, key=self.key.private_key)
  File "/home/dwalleck/opencafe_demo/cafe_env/local/lib/python2.7/site-packages/cloudcafe/compute/servers_api/behaviors.py", line 539, in get_remote_instance_client
    from cloudcafe.compute.common.clients.remote_instance.linux.\
  File "/home/dwalleck/opencafe_demo/cafe_env/local/lib/python2.7/site-packages/cloudcafe/compute/common/clients/remote_instance/linux/linux_client.py", line 22, in <module>
    from cafe.engine.ssh.client import SSHAuthStrategy, SSHClient
  File "/home/dwalleck/opencafe_demo/cafe_env/local/lib/python2.7/site-packages/cafe/engine/ssh/client.py", line 21, in <module>
    from paramiko.resource import ResourceManager
ImportError: No module named resource 

Digging back into Paramiko, it appears that the ResourceManager was removed because fixes for memory leaks and other issues deprecated its use:

paramiko/paramiko#949
paramiko/paramiko#952

The back-reference from Transport to SSHClient was added because
the SSHClient had a destructor that would close the Transport,
and some users did not want the Transport closed when the SSHClient
was garbage collected.

The SSHClient destructor was not a normal destructor, it was
implemented with the ResourceManager singleton. This sometimes
prevented the GC cycle detector from freeing the SSHClient and
Transport even after the Transport Thread stopped running.

We can simplify these problems by just getting rid of the
ResourceManager, and the back-reference. Transports cannot be
garbage-collected while their Thread is running, .close() must
be called (on the SSHClient or the Transport).

Based on this information, we should be able to remove our additional management of connections safely.

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

1 participant