Bug #49419 Test Connection for SSH connection locks up entire app
Submitted: 3 Dec 2009 20:44 Modified: 15 Jan 2010 11:25
Reporter: Kolbe Kegel Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S1 (Critical)
Version:5.2.11 OS:Linux (mysql-workbench-oss-5.2.10-1ubu804-amd64.deb)
Assigned to: Alfredo Kojima CPU Architecture:Any

[3 Dec 2009 20:44] Kolbe Kegel
Description:
"Test Connection" locks up Workbench if using "Standard TCP/IP over SSH" connection.

How to repeat:
1) New Connection
2) Connection Method: "Standard TCP/IP over SSH"
3) Enter host, user, and password details
4) Hit Test Connection
5) App locks up

Console output:

18743 INFO Connecting to SSH server at 127.0.0.1:22...
Unhandled exception in thread started by <bound method Tunnel._threadloop of <__main__.Tunnel instance at 0x9acea8>>

I can abort the connection attempt with ctrl-c at the console, but the interface is non-responsive to mouse input. Esc will close the New Connection wizard, but application behavior at this point is inconsistent and app will sometimes close unexpectedly.

Suggested fix:
It should of course be possible to successfully Test Connection with "Standard TCP/IP over SSH" connections.
[30 Dec 2009 21:23] Alfredo Kojima
I can not repeat this. Also looking at the code, one of the possible causes of the issue has already been fixed. Please reopen with a copy/paste of console output if you can still repeat in latest release.
[4 Jan 2010 18:49] Kolbe Kegel
Reproduced as described in 5.2.11 on Ubuntu 8.04.

Starting thread...
Thread started
19579 INFO Connecting to SSH server at 127.0.0.1:22...
19579 INFO Internal error in tunnel manager: AttributeError("'module' object has no attribute 'WarningPolicy'",)
Traceback (most recent call last):
  File "/usr/share/mysql-workbench/sshtunnel.py", line 109, in _threadloop
    self._actual_work(password, keyfile)
  File "/usr/share/mysql-workbench/sshtunnel.py", line 117, in _actual_work
    if not self._connect_ssh(password, keyfile):
  File "/usr/share/mysql-workbench/sshtunnel.py", line 85, in _connect_ssh
    self.client.set_missing_host_key_policy(paramiko.WarningPolicy())
AttributeError: 'module' object has no attribute 'WarningPolicy'
[4 Jan 2010 18:57] Alfredo Kojima
What version of the python-paramiko package do you have installed?
[4 Jan 2010 19:09] Kolbe Kegel
Package: python-paramiko
Version: 1.6.4-1.1
[4 Jan 2010 21:23] Alfredo Kojima
This is caused by old paramiko in Ubuntu 8.04 and is only repeatable in that specific Ubuntu version.
Fixed by adding the missing class.
[4 Jan 2010 21:24] Alfredo Kojima
Patch for fix:

--- library/sshtunnel/sshtunnel.py	2009-12-10 15:28:33 +0000
+++ library/sshtunnel/sshtunnel.py	2010-01-04 21:20:59 +0000
@@ -18,6 +18,14 @@
 # timeout for closing an unused tunnel
 TUNNEL_TIMEOUT = 60
 
+# paramiko 1.6 didn't have this class
+if hasattr(paramiko, "WarningPolicy"):
+    WarningPolicy = paramiko.WarningPolicy
+else:
+    class WarningPolicy(paramiko.MissingHostKeyPolicy):
+        def missing_host_key(self, client, hostname, key):
+            print 'WARNING: Unknown %s host key for %s: %s' % (key.get_name(), hostname, hexlify(key.get_fingerprint()))
+
 
 class Tunnel:
     def __init__(self, q, tunnel_manager, server, username, target, threaded=True):
@@ -82,7 +90,7 @@
     def _connect_ssh(self, password, keyfile):
         self.client = paramiko.SSHClient()
         self.client.load_system_host_keys()
-        self.client.set_missing_host_key_policy(paramiko.WarningPolicy())
+        self.client.set_missing_host_key_policy(WarningPolicy())
 
         try:
             self.client.connect(self.server[0], self.server[1], username=self.username, key_filename=keyfile, password=password)
[13 Jan 2010 17:48] Johannes Taxacher
fix will be included in 5.2.12
[15 Jan 2010 11:25] Tony Bedford
An entry has been added to the 5.2.12 changelog:

Clicking the Test Connection button in the Manage DB Connections dialog caused MySQL Workbench to lock up. The error generated on the console was:

18743 INFO Connecting to SSH server at 127.0.0.1:22...
Unhandled exception in thread started by <bound method Tunnel._threadloop of
<__main__.Tunnel instance at 0x9acea8>>
[15 Jan 2010 11:28] Tony Bedford
Copy and paste error. This paragraph was also part of the changelog entry:

This happened for the connection method Standard TCP/IP over SSH.