Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_green_existing_locks raises an attribute error under PyPy2.7 v 7.x.x #559

Open
olliemath opened this issue Mar 25, 2019 · 3 comments
Open

Comments

@olliemath
Copy link

Issue

Calling monkey_patch on PyPy 2.7 v7.x.x causes an AttributeError if there are any existing RLock objects.

Python 2.7.13 (...)
[PyPy 7.1.0 with GCC 8.2.1 20181127] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> from threading import RLock
>>>> import eventlet
>>>> lock = RLock()
>>>> lock.acquire()
True
>>>> eventlet.monkey_patch()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/oliver/.virtualenvs/enventletpypy/site-packages/eventlet/patcher.py", line 265, in monkey_patch
    _green_existing_locks()
  File "/home/oliver/.virtualenvs/enventletpypy/site-packages/eventlet/patcher.py", line 358, in _green_existing_locks
    isinstance(obj._RLock__block, lock_type)):
AttributeError: 'thread.RLock' object has no attribute '_RLock__block'

Here's a minimal dockerfile if you want to reproduce locally:

FROM pypy:2-7.0.0
RUN pip install eventlet==0.24.1

RUN echo "from threading import RLock; import eventlet; lock = RLock(); lock.acquire(); eventlet.monkey_patch()" > /run.py
ENTRYPOINT ["pypy", "/run.py"]

Cause

The latest version of PyPy backports threading._CRLock from Python3. It uses this as threading.RLock and demotes the original python implementation to threading._PyRLock.

@gordol
Copy link

gordol commented Jun 18, 2019

seems like this should be simple to patch here?
https://github.com/eventlet/eventlet/blob/master/eventlet/patcher.py#L318

@gordol
Copy link

gordol commented Jun 18, 2019

gevent fix over here for reference: gevent/gevent#1357

@gordol
Copy link

gordol commented Jun 18, 2019

and there's a PR already over here: #547

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants