SNI support in python 2.7 for Locust load tests

Reddy reddy at poczta.fm
Tue Sep 30 10:50:40 EDT 2014


Hello,

At the beginning - welcome everyone, as this is my first post here. I'm not an active Python developer now, but I have general knowledge of the language. 

I'm trying to use locust (http://locust.io/) to run load test of one site we're developing. Everything was running nice and smooth until we switch the servers to use SNI. SNI is not officially supported in python 2.7.5 but Locust doesn't work on python3 as it uses gevent which AFAIK are supported for python2 only. I finally managed to run our scripts on local Ubuntu after upgrading python to 2.7.8 from utopic repository but I can't replicate the same on target CentOS where the scripts are supposed to be executed. I tried compiling python from http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz, I even tried unpacking sources of Ubuntu python2.7 package (from http://se.archive.ubuntu.com/ubuntu/pool/main/p/python2.7/python2.7_2.7.8.orig.tar.gz), patching them with TLS1_1 and TLS1_2 support from  https://bugs.python.org/file30761/python-2.7.5-tls1.1-and-tls1.2.patch) and still no luck. I do monkey patch in Locust startup file according to http://stackoverflow.com/a/19477363 (otherwise it wouldn't work on Ubuntu as well) but still I get error stack as attached below. I also checked with pip list that all python packages have the same versions on both systems. Any idea what I'm missing on the target load test system which I have in Ubuntu? 

Regards,
Reddy

...
[2014-09-30 14:19:41,771] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 503, in put
[2014-09-30 14:19:41,771] ip-x-x-x-x/ERROR/stderr: return self.request('PUT', url, data=data, **kwargs)
[2014-09-30 14:19:41,771] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/locust/clients.py", line 111, in request
[2014-09-30 14:19:41,772] ip-x-x-x-x/ERROR/stderr: response = self._send_request_safe_mode(method, url, **kwargs)
[2014-09-30 14:19:41,772] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/locust/clients.py", line 155, in _send_request_safe_mode
[2014-09-30 14:19:41,772] ip-x-x-x-x/ERROR/stderr: return requests.Session.request(self, method, url, **kwargs)
[2014-09-30 14:19:41,773] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 451, in request
[2014-09-30 14:19:41,773] ip-x-x-x-x/ERROR/stderr: resp = self.send(prep, **send_kwargs)
[2014-09-30 14:19:41,773] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 557, in send
[2014-09-30 14:19:41,774] ip-x-x-x-x/ERROR/stderr: r = adapter.send(request, **kwargs)
[2014-09-30 14:19:41,774] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 362, in send
[2014-09-30 14:19:41,775] ip-x-x-x-x/ERROR/stderr: timeout=timeout
[2014-09-30 14:19:41,775] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 516, in urlopen
[2014-09-30 14:19:41,775] ip-x-x-x-x/ERROR/stderr: body=body, headers=headers)
[2014-09-30 14:19:41,776] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 308, in _make_request
[2014-09-30 14:19:41,776] ip-x-x-x-x/ERROR/stderr: conn.request(method, url, **httplib_request_kw)
[2014-09-30 14:19:41,776] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/httplib.py", line 995, in request
[2014-09-30 14:19:41,777] ip-x-x-x-x/ERROR/stderr: self._send_request(method, url, body, headers)
[2014-09-30 14:19:41,777] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/httplib.py", line 1029, in _send_request
[2014-09-30 14:19:41,778] ip-x-x-x-x/ERROR/stderr: self.endheaders(body)
[2014-09-30 14:19:41,778] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/httplib.py", line 991, in endheaders
[2014-09-30 14:19:41,778] ip-x-x-x-x/ERROR/stderr: self._send_output(message_body)
[2014-09-30 14:19:41,779] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/httplib.py", line 848, in _send_output
[2014-09-30 14:19:41,779] ip-x-x-x-x/ERROR/stderr: self.send(message_body)
[2014-09-30 14:19:41,779] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/httplib.py", line 817, in send
[2014-09-30 14:19:41,780] ip-x-x-x-x/ERROR/stderr: self.sock.sendall(datablock)
[2014-09-30 14:19:41,792] ip-x-x-x-x/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 203, in sendall
[2014-09-30 14:19:41,793] ip-x-x-x-x/ERROR/stderr: return self.connection.sendall(data)
[2014-09-30 14:19:41,793] ip-x-x-x-x/ERROR/stderr: File "build/bdist.linux-x86_64/egg/OpenSSL/SSL.py", line 977, in sendall
[2014-09-30 14:19:41,793] ip-x-x-x-x/ERROR/stderr: File "build/bdist.linux-x86_64/egg/OpenSSL/SSL.py", line 849, in _raise_ssl_error
[2014-09-30 14:19:41,794] ip-x-x-x-x/ERROR/stderr: OpenSSL.SSL
[2014-09-30 14:19:41,794] ip-x-x-x-x/ERROR/stderr: .
[2014-09-30 14:19:41,794] ip-x-x-x-x/ERROR/stderr: WantWriteError



More information about the Python-list mailing list