[pypy-dev] FAQ entry

Armin Rigo arigo at tunes.org
Tue Apr 7 10:07:53 CEST 2015


Hi Maciej,

On 6 April 2015 at 21:08, Maciej Fijalkowski <fijall at gmail.com> wrote:
> My question stands - should we add this short explanation (maybe with
> a link to the blog post) to FAQ as to why you should not use locks in
> dels?

My problem with the blog post is that, after it correctly diagnoses
the problem, it doesn't really solve it at all.  It just moves
allocations around to avoid having them while the lock is held.  This
is a workaround that can fail; any Python code can allocate.  Even if
it's not obvious why, when the JIT happen to be tracing that code,
then you have many more allocations than usual, for example.  So the
blog post's solution is not a proper fix but merely reduces the
likelihood of a deadlock.

> Or maybe why you should not have advanced logic in dels to start
> with.

That would be a much better solution.

I suppose we should also look at the blog post's original code and try
to figure out, in this case, how to do it cleanly.  If we can, we
should mention how in the FAQ entry.  But if it turns out to be close
to impossible, we should mention in the FAQ entry that APIs can be too
badly designed from that point of view, and still hint as some
reasonable workarounds...


A bientôt,

Armin.


More information about the pypy-dev mailing list