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

Broken requests #37

Open
adotorc opened this issue Nov 5, 2017 · 2 comments
Open

Broken requests #37

adotorc opened this issue Nov 5, 2017 · 2 comments

Comments

@adotorc
Copy link

adotorc commented Nov 5, 2017

As soon as signalr is imported, normal requests queries using ssl (get/post) fail to initialize, entering in a recursion loop that ultimately makes them crash.

Steps to reproduce:

import requests
import signalr
requests.get("https://www.google.com")

Traceback here:

Traceback (most recent call last):
File "signalrRequestCrash.py", line 3, in
requests.get("https://www.google.com")
File "C:\Program Files (x86)\Python36-32\lib\site-packages\requests\api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\requests\adapters.py", line 440, in send
timeout=timeout
File "C:\Program Files (x86)\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
chunked=chunked)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 850, in validate_conn
conn.connect()
File "C:\Program Files (x86)\Python36-32\lib\site-packages\urllib3\connection.py", line 314, in connect
cert_reqs=resolve_cert_reqs(self.cert_reqs),
File "C:\Program Files (x86)\Python36-32\lib\site-packages\urllib3\util\ssl
.py", line 269, in create_urllib3_context
context.options |= options
File "C:\Program Files (x86)\Python36-32\lib\ssl.py", line 465, in options
super(SSLContext, SSLContext).options.set(self, value)
File "C:\Program Files (x86)\Python36-32\lib\ssl.py", line 465, in options
super(SSLContext, SSLContext).options.set(self, value)
File "C:\Program Files (x86)\Python36-32\lib\ssl.py", line 465, in options
super(SSLContext, SSLContext).options.set(self, value)
[Previous line repeated 323 more times]
RecursionError: maximum recursion depth exceeded

Python 3.6.3 (32bits, Windows)
Pip freeze results:

altgraph==0.14
asn1crypto==0.23.0
certifi==2017.7.27.1
cffi==1.11.2
chardet==3.0.4
cryptography==2.1.3
Cython==0.27.3
future==0.16.0
gevent==1.2.2
greenlet==0.4.12
idna==2.6
macholib==1.8
numpy==1.13.3
pefile==2017.9.3
pycparser==2.18
PyInstaller==3.3
pypiwin32==220
pyTelegramBotAPI==3.2.1
PyYAML==3.12
requests==2.18.4
shellescape==3.4.1
signalr-client==0.0.7
six==1.11.0
sseclient==0.0.18
TA-Lib==0.4.10
urllib3==1.22
websocket-client==0.44.0

@zplizzi
Copy link

zplizzi commented Nov 18, 2017

Similar problem, these four lines cause a crash (IOError: [Errno 11] Resource temporarily unavailable):

from multiprocessing import Manager
from signalr import Connection

manager = Manager()
order_books = manager.dict()

Manager uses sockets for the interprocess communication, so I assume that's how these issues are related.

@alexykot
Copy link

I've encountered same thing just now, and the solution is to import and monkey patch gevent before that. I.e.:

import gevent.monkey
gevent.monkey.patch_all()

from requests import Session
from signalr import Connection

This prevents the infinite recursion problem.

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

3 participants