Skip to content
Advertisement

Error in running python locust script from two different Linux Distribution

I write a locust script to test a web site. The script is very simple, just a request repeated several time.

In a virtual machine with Linux Mint and Python 2.7.6, the script works in the right way and as I want.

For example, I run the script without the Web Interface as write below:

locust --no-web -n 10 -c 1 -r 1 -f /path/to/file/file_test.py

and I obtain the right stats in the terminal window.

When I run the same script on another virtual machine with CentOS and Python 2.7.11, I obtain the following error:

[2016-05-20 12:26:03,954] nix/ERROR/stderr: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/locust/core.py", line 267, in run
    self.execute_next_task()
  File "/usr/local/lib/python2.7/site-packages/locust/core.py", line 293, in execute_next_task
    self.execute_task(task["callable"], *task["args"], **task["kwargs"])
  File "/usr/local/lib/python2.7/site-packages/locust/core.py", line 305, in execute_task
    task(self, *args, **kwargs)
  File "/data/IVV/multi_benchmark/locust_scripts/OD_skip_top_multi_query.py", line 15, in query1
    self.client.get(QUERY, verify=False)
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 487, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/locust/clients.py", line 113, in request
    response = self._send_request_safe_mode(method, url, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/locust/clients.py", line 157, in _send_request_safe_mode
    return requests.Session.request(self, method, url, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 585, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 403, in send
    timeout=timeout
  File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 578, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 351, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 814, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connection.py", line 289, in connect
    ssl_version=resolved_ssl_version)
  File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py", line 308, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/local/lib/python2.7/ssl.py", line 352, in wrap_socket
    _context=self)
TypeError: __init__() got an unexpected keyword argument 'server_hostname'
[2016-05-20 12:26:04,911] nix/INFO/locust.runners: All locusts hatched: MyLocust: 1
[2016-05-20 12:26:04,911] nix/INFO/locust.runners: Resetting stats

Could you please help me understanding the problem? Thanks very much.

Advertisement

Answer

It seems to be a known issue in urllib3, it has nothing to to with your scripts. See https://github.com/shazow/urllib3/issues/482

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement