[issue26839] Python 3.5 running on Linux kernel 3.17+ can block at startup or on importing the random module on getrandom()

Donald Stufft report at bugs.python.org
Tue Jun 7 14:40:30 EDT 2016


Donald Stufft added the comment:

> As a final note, let me steer you towards this comment in Python/random.c:
>
> /* Issue #25003: Don' use getentropy() on Solaris (available since
>  * Solaris 11.3), it is blocking whereas os.urandom() should not block. */
>
> Yes: we already had this discussion for Solaris, nine months ago, on issue #25003.  Both Guido and Tim Peters were involved in the discussion.  The decision there: use lower-quality random bits to seed the MT when importing the random module.  Keeping the slowdown was so obviously wrong it wasn't even debated.

I will point out, that was a somewhat different situation as ``getentropy`` on Solaris is more like /dev/random in that it tries to decide how much random-ness is in the pool and will randomly block throughout the execution of the program. The ``getrandom()`` call on Linux (and Solaris) will, by default, only block on the first boot at the very beginning before the kernel has collected enough entropy.

I don't think this changes anything, I just want to be clear because there are two kinds of "blocking" in this discussion, one that only occurs in very specific scenarios and one that occurs regularly in the operation of the program.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26839>
_______________________________________


More information about the Python-bugs-list mailing list