Comment 13 for bug 1150720

Adam Gandelman (gandelman-a) wrote :

Using a variation of a test case for the same bug found at http://redes-privadas-virtuales.blogspot.com/2013/02/paramiko-object-with-process-rng-must.html.

Looks like this is actually still in issue using the patched package in raring python-paramiko 1.7.7.1-3.1, and the similarly patched package in precise-proposed doesn't fix the issue either.

Test case:

import paramiko

from multiprocessing import Process

class B():
    def __init__(self):
        self.__process = None
        self.__ssh = paramiko.SSHClient()
        self.__ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        self.__ssh.connect('somelocalsystem', username='adam', password='xxxxxx')

    def start(self):
        self.__process = Process(target=self.__run_process)
        self.__process.start()

    def __run_process(self):
        _, stdout, _ = self.__ssh.exec_command("hostname")

b = B()
b.start()

Results in a exception on both /w both raring and precise-proposed packages:

  File "/usr/lib/python2.7/dist-packages/Crypto/Random/_UserFriendlyRNG.py", line 138, in _check_pid
    raise AssertionError("PID check failed. RNG must be re-initialized after fork(). Hint: Try Random.atfork()")
AssertionError: PID check failed. RNG must be re-initialized after fork(). Hint: Try Random.atfork()
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
  File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1578, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'