[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pypy-dev
Subject:    Re: [pypy-dev] Deadlock in cpyext callback
From:       Nick Williams <nhw () me ! com>
Date:       2014-05-26 4:24:01
Message-ID: 22D8CE8A-E83F-4708-8248-8DD88864C825 () me ! com
[Download RAW message or body]

Armin,

> The documentation of PyGILState_Ensure() says, indeed, that it's ok to
> call this function even if the current thread already owns the GIL.
> If PyPy's version deadlocks in this case, then it's a bug of PyPy.
> Please file it as a bug (https://bitbucket.org/pypy/pypy/issues; also
> look a bit in case a similar bug would be already reported and waiting
> there).  You can also try to look in the implementation of
> PyGILState_Ensure() to make sure.

Thanks for the response. We found that by adding a 'with nogil' to our Cython we were \
able to resolve the problem. However, it's a bit error prone. The callback is for \
logging and the implication is that we have to release the GIL at any point where we \
call into C++ and log may be output. Since the same callback may also be called from \
a non Python thread we do need to ensure the GIL from there, so we can't just drop \
it. 

From my point of view, it does seem like a PyPy bug; will check the tracker and open \
a bug if there's not already one. 

Thanks again

Nick

_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic