Issue 24026: Python hangs forever in wait() of threading.py (original) (raw)

I use paramiko to create SSH sessions to Linux machines, which works great 95% of the time. But sometimes, the Python process which creates the SSH session hangs forever in wait() of threading.py (see attachment 'gdb.txt' for full output).

{code} (gdb) py-list 239 waiter.acquire() 240 self.__waiters.append(waiter) 241 saved_state = self._release_save() 242 try: # restore state no matter what (e.g., KeyboardInterrupt) 243 if timeout is None:

244 waiter.acquire() 245 if debug: 246 self._note("%s.wait(): got it", self) 247 else: 248 # Balancing act: We can't afford a pure busy loop, so we 249 # have to sleep; but if we sleep the whole timeout time,

(gdb) py-bt #5 Frame 0xb459a5c, for file /usr/lib/python2.7/threading.py, line 244, in wait (self=<_Condition(_Verbose__verbose=False, _Condition__lock=<thread.lock at remote 0xaf7e3a0>, acquire=<built-in method acquire of thread.lock object at remote 0xaf7e3a0>, _Condition__waiters=[<thread.lock at remote 0xaf7e100>], release=<built-in method release of thread.lock object at remote 0xaf7e3a0>) at remote 0xb73708c>, timeout=None, waiter=<thread.lock at remote 0xaf7e100>, saved_state=None) waiter.acquire() #9 Frame 0xb66118c, for file /usr/lib/python2.7/dist-packages/paramiko/buffered_pipe.py, line 137, in read (self=<BufferedPipe(_closed=False, _lock=<thread.lock at remote 0xaf7e3a0>, _buffer=<array.array at remote 0xb737ea0>, _event=None, _cv=<_Condition(_Verbose__verbose=False, _Condition__lock=<thread.lock at remote 0xaf7e3a0>, acquire=<built-in method acquire of thread.lock object at remote 0xaf7e3a0>, _Condition__waiters=[<thread.lock at remote 0xaf7e100>], release=<built-in method release of thread.lock object at remote 0xaf7e3a0>) at remote 0xb73708c>) at remote 0xb737a4c>, nbytes=8192, timeout=None, out='', then=<float at remote 0xb57efe4>) self._cv.wait(timeout) {code}