Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Workaround for SSL exception with gevent on PyPy 2.2+ #11

Open
parasyte opened this issue Dec 4, 2013 · 1 comment
Open

Workaround for SSL exception with gevent on PyPy 2.2+ #11

parasyte opened this issue Dec 4, 2013 · 1 comment

Comments

@parasyte
Copy link

parasyte commented Dec 4, 2013

gevent 1.0 on PyPy 2.2+ throws an exception when an SSL socket is created. Here's a partial stack trace (removing private paths, etc.)

Traceback (most recent call last):
  File "app_main.py", line 72, in run_toplevel

  *snip*

  File "/usr/local/Cellar/pypy/2.2.1/libexec/lib-python/2.7/httplib.py", line 1028, in getresponse
    response = self.response_class(*args, **kwds)
  File "/usr/local/Cellar/pypy/2.2.1/libexec/lib-python/2.7/httplib.py", line 346, in __init__
    self.fp = sock.makefile('rb', 0)
  File "*snip*/pypy-2.2.1/site-packages/gevent/ssl.py", line 364, in makefile
    return _fileobject(self, mode, bufsize, close=True)
  File "/usr/local/Cellar/pypy/2.2.1/libexec/lib-python/2.7/socket.py", line 300, in __init__
    sock._reuse()
AttributeError: 'SSLSocket' object has no attribute '_reuse'
Exception KeyError: KeyError(4372283104L,) in threading._shutdown() ignored

The workaround is taken directly from PyPy and applied to gevent. (Not optimal; this is a PyPy bug.)

pubnub/gevent@bdee26c

@parasyte
Copy link
Author

parasyte commented Dec 5, 2013

It just occurred that the same patch is needed on gevent's plain socket implementation.

pubnub/gevent@e959acf

This branch can be used with PyPy 2.2+ and pypycore by following the pypycore README. Just replace the schmir/pypy-hacks branch with pubnub/pypy-hacks

@schmir schmir mentioned this issue Dec 20, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant