paramiko SSHClient.connect not thread safe

Asked by Matthew Newcomb

Hi,

Ubuntu 10.04, python 2.6.5 and a few threads that basically do this:

s = paramiko.SSHClient()
s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
s.load_system_host_keys()
s.connect(hostname, username=uname)

Running these threads causes this exception:

Traceback (most recent call last):
  File "threadedssh.py", line 67, in run
    s.connect(hostname, username=uname)
  File "/usr/lib/pymodules/python2.6/paramiko/client.py", line 278, in connect
    for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM):
gaierror: [Errno -2] Name or service not known

However if I do this:

sLock.acquire()
s.connect(hostname, username=uname)
sLock.release()

Everything works just fine.

What can I do????

Question information

Language:
English Edit question
Status:
Needs information
For:
Ubuntu paramiko Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Have you logged a bug?

Can you help with this problem?

Provide an answer of your own, or ask Matthew Newcomb for more information if necessary.

To post a message you must log in.