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

ConnectionError(ProtocolError('Connection aborted.', BadStatusLine("''",)),) #308

Closed
vinayrajalur opened this issue Jul 23, 2015 · 10 comments

Comments

@vinayrajalur
Copy link

Hi Team,

I am are trying load test SSO(Single sign-on) flow with our server. For some of the requests i am getting "ConnectionError(ProtocolError('Connection aborted.', BadStatusLine("''",)),)". When i try to read the response it as Status Code 0 and no header fields. As the error says its due the connection aborted. can you please help me what is causing this issue?.
i have seen issue happens for response time of within 1 sec.

@heyman
Copy link
Member

heyman commented Jul 26, 2015

Hi!

Does it work if you just use plain Python and Requests (http://docs.python-requests.org/en/latest/)?

@vinayrajalur
Copy link
Author

Hi Heyman,

i tried using only Requests and issue happens after 2050 requests , i am using gevent to send 10 concurrent requests at a time. following is the traceback:

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gevent-1.0.1-py2.7-linux-x86_64.egg/gevent/greenlet.py", line 327, in run
result = self._run(_self.args, *_self.kwargs)
File "test_BadStatusLine.py", line 16, in get_resp
resp = requests.get(url)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 65, in get
return request('get', url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 49, in request
response = session.request(method=method, url=url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 461, in request
resp = self.send(prep, *_send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(110, 'Connection timed out'))
<Greenlet at 0x239ab90: get_resp(')> failed with ConnectionError

Traceback (most recent call last):
File "test_BadStatusLine.py", line 27, in
pool.map(get_resp,urls)
File "/usr/local/lib/python2.7/dist-packages/gevent-1.0.1-py2.7-linux-x86_64.egg/gevent/pool.py", line 169, in map
return list(self.imap(func, iterable))
File "/usr/local/lib/python2.7/dist-packages/gevent-1.0.1-py2.7-linux-x86_64.egg/gevent/pool.py", line 293, in next
raise value.exc
requests.exceptions.ConnectionError: ('Connection aborted.', error(110, 'Connection timed out'))

i run locust in parallel with the above script , here issue is happening for every 10 - 20 requests.

@vinayrajalur
Copy link
Author

Any update on this issue?

@vividhsv
Copy link

Looks like this an error from httplib.
Looks like the issue is fixed on python 3.5. However, it is still an issue on python 2.7

Get more info on the following links
https://github.com/kennethreitz/requests/issues/2364
https://bugs.python.org/issue23054

@kevbo
Copy link

kevbo commented Jan 25, 2016

FWIW, I was able to prevent this error by reducing the max_wait time so that the worker wouldn't exceed the timeout on the keep-alive connection (see https://bugs.python.org/msg103545)

@vadi2
Copy link

vadi2 commented Jul 18, 2018

What did you reduce max_wait to?

@meldehi
Copy link

meldehi commented Aug 9, 2018

I am hitting the same issue. I am using python 3.7. It starts happening once I hit the max number of clients. I tried putting down the max_wait and min_wait time to 50 but that does not help as well.

@samuelralak
Copy link

any update on this issue? am in the same predicament as @meldehi, using Python 3.7

@ddorian
Copy link

ddorian commented Jun 6, 2019

Create a global Connection Pooler for requests and attach it to self.locust.client whenever the LocustUser is started (by overriding init). That fixed it in my case

@ddorian
Copy link

ddorian commented Jun 6, 2019

Also, add timeouts to calls from requests self.client to see if the host isn't responding so they don't hang forever.

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

9 participants