This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lcaamano
Date 2005-04-19.16:53:25
SpamBayes Score
Marked as misclassified
Logged In: YES 

We're facing this problem.  We're thinking of patching our 
module to always open /dev/urandom on every call.  Does 
anybody know if this would have any bad consequences other 
than the obvious system call overhead?

BTW, here's the traceback we get.  As you probably can guess, 
something called os.urandom before we closed all file descriptors 
in the daemonizing code and it then failed when os.urandom 
tried to use the cached fd.

 Traceback (most recent call last):
   File  "/opt/race/share/sw/common/bin/dpmd", line 27, in ?
   File  "Linux/", line 336, in run
   File  "Linux/", line 324, in main
   File  "Linux/", line 61, in addServices
   File  "Linux/", line 293, in __init__
   File  "Linux/", line 44, in start
   File  "Linux/", line 165, in createThread
   File  "Linux/", line 126, in __init__
File  "/opt/race/share/sw/os/Linux_2.4_i686/python/lib/python2.4/t", line 423, in NamedTemporaryFile
 dir = gettempdir()
File  "/opt/race/share/sw/os/Linux_2.4_i686/python/lib/python2.4/t", line 262, in gettempdir
 tempdir =  _get_default_tempdir()
File  "/opt/race/share/sw/os/Linux_2.4_i686/python/lib/python2.4/t", line 185, in _get_default_tempdir
 namer =  _RandomNameSequence()
File  "/opt/race/share/sw/os/Linux_2.4_i686/python/lib/python2.4/t", line 121, in __init__
 self.rng = _Random()
File "/opt/race/share/sw/os/Linux_2.4_i686/python/lib/python2.4/r", line 96, in __init__
File "/opt/race/share/sw/os/Linux_2.4_i686/python/lib/python2.4/r", line 110, in seed

 a =  long(_hexlify(_urandom(16)), 16)

File  "/opt/race/share/sw/os/Linux_2.4_i686/python/lib/python2.4/", line  728, in urandom 
 bytes +=  read(_urandomfd, n - len(bytes))

 OSError : [Errno 9] Bad file  descriptor

Date User Action Args
2007-08-23 14:30:45adminlinkissue1177468 messages
2007-08-23 14:30:45admincreate