[pypy-dev] Dead loop occurs when using python-daemon and multiprocessing together in PyPy 4.0.1

Vincent Legoll vincent.legoll at gmail.com
Sat Dec 26 07:45:49 EST 2015

OK, I understand we want to have behavior as identical to cpython as possible.

So does that mean implementing the same : "fstat() & check we're still
on the same inode & device as before" ?
See cpython's Python/random.c:208

This I have done, but I'll need help to make the test work (as in
detect something is working after the patch that was not before)...

Do we also need to do the "could have been opened in another thread" dance ?

And what about the CLO_EXEC thing, this does seem sensible to do too,
albeit not directly tied to the bug, even if it would make it happen
in more cases (I think)

On Thu, Dec 24, 2015 at 8:28 PM, Armin Rigo <arigo at tunes.org> wrote:
> Hi Vincent,
> On Thu, Dec 24, 2015 at 5:50 PM, Vincent Legoll
> <vincent.legoll at gmail.com> wrote:
>> Are we really seeing a closed and reopened fd ?
>> And if that's the case it may even be intentional ;-)
>> because if we're only seeing a closed python file object, we could go
>> the simpler way:
>> -        if not context[0]:
>> +        if (not context[0] or
>> +            type(context[0]) == file and context[0].closed):
>>              context[0] = os.open("/dev/urandom", os.O_RDONLY, 0777)
>> I'll try to reproduce first then test if this simple fix is enough...
> No, please don't commit "half fixes" like that.  We know that there is
> a situation in which bad things occurs, so we need to deal with it.
> Fixing half the problem might make this particular case work, but not
> all of them.  At least the current situation is not very good
> performance-wise but should work.
> A bientôt,
> Armin.

Vincent Legoll

More information about the pypy-dev mailing list