EOFError when threading
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
paramiko |
New
|
Undecided
|
Unassigned |
Bug Description
When threading multiple SSH sessions Transport.
Example:
class Router(Thread):
tlist = []
lock = Lock()
def __init__(self, login):
def run(self):
if __name__ == '__main__':
for rtr, login in ROUTERS.items():
rtr = Router(login)
for rtr in Router.tlist:
If I go lower and use SSHClient only for connecting then get_transport, and open_session I will have the same result. However, if I create two channels using open_session before running an exec_command on either, it will work as expected without an EOFError.
Example that works:
tran = self.ssh.
chan1 = tran.open_session()
chan2 = tran.open_session()
chan1.exec_
# Do something with chan1.makefile
chan2.exec_
# Do something with chan2.makefile
Example that will raise random EOFErrors:
tran = self.ssh.
chan = tran.open_session()
chan.exec_
# Do something with chan.makefile
chan = tran.open_session()
# Raises random EOFErrors
Also if I limit the thread count to 1 using Event() everything works as expected, but if I limit the thread count to anything over 1 I see the random EOFErrors.
I would be happy to provide more details if needed.