Thanks for the response. Should I put it directly in the bug
tracker?
FYI, I've located the reason to be the incompatibility with python-daemon
(or rather the standard unix-daemon behavior) and
PyPy posix.urandom implementation.
It seems that in PyPy 4.0.1, when module random loaded, a
file descriptor is created on /dev/urandom. I think PyPy implementation use the
shared descriptor to read from /dev/urandom. Sadly when python-daemon fork the
process and turns it into an unix daemon, it closes all the currently open file
descriptors. After that all os.urandom calls failed with OSError. I think maybe
the other functions of Random class is also using the file descriptor in C
code and just never detects if the return value is 0, and causes the
dead loop.
I think the problem will be solved if the implementation re-open
the handle when it is closed somehow.
multiprocessing is using random internally. Also there are lots of
other modules using random, like email etc. The dead loop occurs when you use
any of the libraries in a daemon.
2015-12-23
hubo
发件人:Maciej Fijalkowski <fijall@gmail.com>
发送时间:2015-12-23 19:35
主题:Re: [pypy-dev] Dead loop occurs when using
python-daemon and multiprocessing together in PyPy 4.0.1
收件人:"hubo"<hubo@jiedaibao.com>
抄送:"pypy-dev"<pypy-dev@python.org>
Hi hubo
Can you put it as a bug report? Those things get easily lost on the
mailing list (and sadly I won't look at it right now, multiprocessing scares
me)