[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: python 2.4: os.urandom() hangs if /dev/random, /dev/urandom are not reconnected to a translator



Hi,

On Thu, Jan 25, 2007 at 11:36:01PM +0000, massimo s. wrote:

> I noticed that gconf-schemas was hung (even overnight) until ctrl-c is
> pressed.
[...]
> When using ctrl-c python gives the following traceback, showing the
> instruction where it hangs:
[...]
> File "/usr/lib/python2.4/os.py", line 723, in urandom bytes +=
> read(_urandomfd, n - len(bytes))

> At first I tried showtrans on the /dev/random, /dev/urandom devices
> and I found they were attached to the unofficial translator
> (http://hurd.gnufans.org/bin/view/Hurd/RandomDevice). Resetting
> /dev/random, /dev/urandom by detaching (settrans -fg /dev/urandom) and
> then reattaching the translator fixed the bug. If I release the
> translator the bug comes out again.

Does it also hang if you don't have a translator there at all?

>From the above description, it sounds like this is indeed a bug in the
urandom translator: The read() operation never returns.

There is no simple way to protect against such misbehaviour in a
translator, so I don't think there is anything to fix on the Python
side.

-antrik-



Reply to: