Bug #84907 Can't connect to MySQL database over SSH using private key
Submitted: 9 Feb 2017 12:28 Modified: 16 Feb 2017 6:32
Reporter: Paweł Adamczyk Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:6.3.9 OS:Microsoft Windows (Microsoft Windows 8.1 Pro)
Assigned to: CPU Architecture:Any
Tags: ssh, WBBugReporter

[9 Feb 2017 12:28] Paweł Adamczyk
Description:
app has been upgraded from 6.3.8 to 6.3.9 i can't connect to my databases with workbench.

Logs:
13:11:15 [INF][     SSH tunnel]: Existing SSH tunnel not found, opening new one
13:11:15 [INF][     SSH tunnel]: Opening SSH tunnel to ccc.cc.cc.ccc:22
13:11:15 [ERR][sshtunnel.py:notify_exception_error:235]: Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\sshtunnel.py", line 303, in _connect_ssh
    look_for_keys=has_key, allow_agent=has_key, timeout=SSH_CONNECTION_TIMEOUT)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\client.py", line 367, in connect
    look_for_keys, gss_auth, gss_kex, gss_deleg_creds, gss_host)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\client.py", line 517, in _auth
    self._agent = Agent()
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\agent.py", line 363, in __init__
    self._connect(conn)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\agent.py", line 66, in _connect
    ptype, result = self._send_message(cSSH2_AGENTC_REQUEST_IDENTITIES)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\agent.py", line 83, in _send_message
    self._conn.send(struct.pack('>I', len(msg)) + msg)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\win_pageant.py", line 123, in send
    self._response = _query_pageant(data)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\win_pageant.py", line 89, in _query_pageant
    _winapi.get_security_attributes_for_user(),
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\_winapi.py", line 364, in get_security_attributes_for_user
    user.SID, 0)
ArgumentError: argument 2: <type 'exceptions.OverflowError'>: long int too long to convert

13:11:16 [INF][     SSH tunnel]: TunnelManager.wait_connection authentication error: Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details
13:11:16 [ERR][     SSH tunnel]: Authentication error opening SSH tunnel: Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details
13:11:17 [INF][      WBContext]: Connection to AAAAAAAAA cancelled by user: Tunnel connection cancelled
13:11:19 [INF][     SSH tunnel]: Existing SSH tunnel not found, opening new one
13:11:19 [INF][     SSH tunnel]: Opening SSH tunnel to yyy.yy.yy.yyy:22
13:11:20 [ERR][sshtunnel.py:notify_exception_error:235]: Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\sshtunnel.py", line 303, in _connect_ssh
    look_for_keys=has_key, allow_agent=has_key, timeout=SSH_CONNECTION_TIMEOUT)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\client.py", line 367, in connect
    look_for_keys, gss_auth, gss_kex, gss_deleg_creds, gss_host)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\client.py", line 517, in _auth
    self._agent = Agent()
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\agent.py", line 363, in __init__
    self._connect(conn)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\agent.py", line 66, in _connect
    ptype, result = self._send_message(cSSH2_AGENTC_REQUEST_IDENTITIES)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\agent.py", line 83, in _send_message
    self._conn.send(struct.pack('>I', len(msg)) + msg)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\win_pageant.py", line 123, in send
    self._response = _query_pageant(data)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\win_pageant.py", line 89, in _query_pageant
    _winapi.get_security_attributes_for_user(),
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\_winapi.py", line 364, in get_security_attributes_for_user
    user.SID, 0)
ArgumentError: argument 2: <type 'exceptions.OverflowError'>: long int too long to convert

13:11:20 [INF][     SSH tunnel]: TunnelManager.wait_connection authentication error: Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details
13:11:20 [ERR][     SSH tunnel]: Authentication error opening SSH tunnel: Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details
13:11:22 [INF][      WBContext]: Connection to ZZZZZZZZZZZZZ cancelled by user: Tunnel connection cancelled
13:11:23 [INF][     SSH tunnel]: Existing SSH tunnel not found, opening new one
13:11:23 [INF][     SSH tunnel]: Opening SSH tunnel to xxx.xx.xx.xxx:13072
13:11:23 [ERR][sshtunnel.py:notify_exception_error:235]: Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\sshtunnel.py", line 303, in _connect_ssh
    look_for_keys=has_key, allow_agent=has_key, timeout=SSH_CONNECTION_TIMEOUT)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\client.py", line 367, in connect
    look_for_keys, gss_auth, gss_kex, gss_deleg_creds, gss_host)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\client.py", line 517, in _auth
    self._agent = Agent()
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\agent.py", line 363, in __init__
    self._connect(conn)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\agent.py", line 66, in _connect
    ptype, result = self._send_message(cSSH2_AGENTC_REQUEST_IDENTITIES)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\agent.py", line 83, in _send_message
    self._conn.send(struct.pack('>I', len(msg)) + msg)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\win_pageant.py", line 123, in send
    self._response = _query_pageant(data)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\win_pageant.py", line 89, in _query_pageant
    _winapi.get_security_attributes_for_user(),
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE/python/site-packages\paramiko\_winapi.py", line 364, in get_security_attributes_for_user
    user.SID, 0)
ArgumentError: argument 2: <type 'exceptions.OverflowError'>: long int too long to convert

13:11:24 [INF][     SSH tunnel]: TunnelManager.wait_connection authentication error: Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details
13:11:24 [ERR][     SSH tunnel]: Authentication error opening SSH tunnel: Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details
13:11:25 [INF][      WBContext]: Connection to VVVVVVVVVV cancelled by user: Tunnel connection cancelled

How to repeat:
configure connection via ssh with private key on 6.3.8 or earlier
upgrade
try to cennect
[16 Feb 2017 6:32] Chiranjeevi Battula
Hello Paweł Adamczyk,

Thank you for the bug report.
This is most likely duplicate of Bug #83485, please see Bug #83485.

Thanks,
Chiranjeevi.
[27 Sep 2017 19:09] Dave Hille
This is most likely not a duplicate of https://bugs.mysql.com/bug.php?id=83485 but a real regression from 6.3.8 to 6.3.9.

Remarks:
a) working on Windows 10
b) MySQL workbench version 6.3.8 works
c) MySQL workbench version 6.3.9 fails with the "ArgumentError" the OP sees in the log
d) as both, 6.3.8 and 6.3.9 use the same version of paramiko (i.e. 1_16_0), it has nothing to do with it

Is there anything I can do to narrow down th ecause?
[3 Jan 2018 11:14] Nikki Locke
I have duplicated this problem.

I have two screens attached to my computer. If I move MySQL Workbench to the right hand screen, I get this problem when I try to open a connection. If I move it to the left hand screen, the connection works.

Is there some code to generate a random number which uses screen coordinates, or something?
[25 Apr 2018 13:09] Latheesan Sivarasathurai
I had the same issue. Dave Hille's comment helps resolve the issue.

Open puttygen.exe and load ssh key file. Click Conversions -> Export OpenSSH key. Use the new file created by this for connections on MySql Workbench.