question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PID check failed. RNG must be re-initialized after fork(). Hint: Try Random.atfork()

See original GitHub issue
PID check failed. RNG must be re-initialized after fork(). Hint: Try Random.atfork()

gsutil exits with this message when I’m trying to copy a lot of large files to google storage:

 gsutil -m cp -r /mnt/some/src gs://some/dest

It’s around 5000 files which vary in size. Their total size is around 100GB. Transfer sometimes succeeds and sometimes fails with the message above.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
houglumcommented, Jan 11, 2019

So, I think most folks don’t see this because it happens under a subset of runtime circumstances. We use oauth2client, which has mechanisms in place to fall back to “pure Python crypto” in the absence of pyOpenSSL – additionally, I believe this only happens when using service account credentials. Fun.

From the PyCrypto docs, I think the fix here is to call Crypto’s Random.atfork() method (if Crypto is installed and can be imported) in the parent and child every time we spawn a new process, whether that be with os.fork(), multiprocessing.Process(), etc.:

Caveat: For the random number generator to work correctly, you must call Random.atfork() in both the parent and child processes after using os.fork()

0reactions
jmcabandaracommented, Jul 25, 2019

I got the error as follows.

Failed RNG.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PyCrypto : AssertionError("PID check failed. RNG must be ...
You need to call Crypto.Random.atfork() after os.fork(). I just put the __init__() in the security module before the other ones.
Read more >
PID check failed. RNG must be re-initialized after fork()
I use paramiko on top of the multiprocessing library, using queues to feed tasks to threads. Each thread or worker imports the paramiko...
Read more >
Run Crypto.Random.atfork() when new worker process is ...
[1] "AssertionError: PID check failed. RNG must be re-initialized after fork(). Hint: Try Random.atfork()". -- You received this message because you are ...
Read more >
PID check failed. RNG must be re-initialized after fork().
Hint : Try Random.atfork(). 2018-05-02 17:47:11,524 - main_check ...
Read more >
Python Random.atfork Examples
... 'PID check failed. RNG must be re-initialized after fork(). Hint: Try Random.atfork()': Random.atfork() return Random.get_random_bytes(size). Example #4.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found