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

SSL broken on Python 2.7.9 #234

Closed
jairtrejo opened this issue Jan 23, 2015 · 7 comments
Closed

SSL broken on Python 2.7.9 #234

jairtrejo opened this issue Jan 23, 2015 · 7 comments

Comments

@jairtrejo
Copy link

Hi! I am trying to use locust on Mac OSX and Python 2.7.9. When trying to run any test that uses an https request, I see the following error:

[2015-01-23 10:25:56,225] sfml-jair.local/INFO/locust.main: Starting Locust 0.7.2
[2015-01-23 10:26:01,967] sfml-jair.local/INFO/locust.runners: Hatching and swarming 1 clients at the rate 1 clients/s...
[2015-01-23 10:26:02,013] sfml-jair.local/ERROR/stderr: Traceback (most recent call last):
[2015-01-23 10:26:02,014] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run
[2015-01-23 10:26:02,015] sfml-jair.local/ERROR/stderr: result = self._run(*self.args, **self.kwargs)
[2015-01-23 10:26:02,015] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/locust/runners.py", line 113, in start_locust
[2015-01-23 10:26:02,017] sfml-jair.local/ERROR/stderr: locust().run()
[2015-01-23 10:26:02,017] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/locust/core.py", line 102, in run
[2015-01-23 10:26:02,018] sfml-jair.local/ERROR/stderr: self.task_set(self).run()
[2015-01-23 10:26:02,018] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/locust/core.py", line 251, in run
[2015-01-23 10:26:02,018] sfml-jair.local/ERROR/stderr: self.on_start()
[2015-01-23 10:26:02,018] sfml-jair.local/ERROR/stderr: File "/Users/jair/src/instaedu/scripts/locust/locustfile.py", line 21, in on_start
[2015-01-23 10:26:02,018] sfml-jair.local/ERROR/stderr: self.login()
[2015-01-23 10:26:02,018] sfml-jair.local/ERROR/stderr: File "/Users/jair/src/instaedu/scripts/locust/locustfile.py", line 25, in login
[2015-01-23 10:26:02,018] sfml-jair.local/ERROR/stderr: "/login", {"email": self.email, "password": "12345678"})
[2015-01-23 10:26:02,018] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 504, in post
[2015-01-23 10:26:02,020] sfml-jair.local/ERROR/stderr: return self.request('POST', url, data=data, json=json, **kwargs)
[2015-01-23 10:26:02,020] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/locust/clients.py", line 111, in request
[2015-01-23 10:26:02,021] sfml-jair.local/ERROR/stderr: response = self._send_request_safe_mode(method, url, **kwargs)
[2015-01-23 10:26:02,021] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/locust/clients.py", line 155, in _send_request_safe_mode
[2015-01-23 10:26:02,021] sfml-jair.local/ERROR/stderr: return requests.Session.request(self, method, url, **kwargs)
[2015-01-23 10:26:02,021] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 461, in request
[2015-01-23 10:26:02,021] sfml-jair.local/ERROR/stderr: resp = self.send(prep, **send_kwargs)
[2015-01-23 10:26:02,021] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
[2015-01-23 10:26:02,024] sfml-jair.local/ERROR/stderr: r = adapter.send(request, **kwargs)
[2015-01-23 10:26:02,024] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 370, in send
[2015-01-23 10:26:02,024] sfml-jair.local/ERROR/stderr: timeout=timeout
[2015-01-23 10:26:02,024] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 518, in urlopen
[2015-01-23 10:26:02,024] sfml-jair.local/ERROR/stderr: body=body, headers=headers)
[2015-01-23 10:26:02,025] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 322, in _make_request
[2015-01-23 10:26:02,025] sfml-jair.local/ERROR/stderr: self._validate_conn(conn)
[2015-01-23 10:26:02,025] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 727, in _validate_conn
[2015-01-23 10:26:02,026] sfml-jair.local/ERROR/stderr: conn.connect()
[2015-01-23 10:26:02,026] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connection.py", line 238, in connect
[2015-01-23 10:26:02,026] sfml-jair.local/ERROR/stderr: ssl_version=resolved_ssl_version)
[2015-01-23 10:26:02,026] sfml-jair.local/ERROR/stderr: File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py", line 253, in ssl_wrap_socket
[2015-01-23 10:26:02,027] sfml-jair.local/ERROR/stderr: return context.wrap_socket(sock, server_hostname=server_hostname)
[2015-01-23 10:26:02,027] sfml-jair.local/ERROR/stderr: File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 350, in wrap_socket
[2015-01-23 10:26:02,027] sfml-jair.local/ERROR/stderr: _context=self)
[2015-01-23 10:26:02,027] sfml-jair.local/ERROR/stderr: TypeError: __init__() got an unexpected keyword argument 'server_hostname'
[2015-01-23 10:26:02,029] sfml-jair.local/ERROR/stderr: <Greenlet at 0x10d915370: start_locust(<class 'locustfile.InstaEDUUser'>)> failed with TypeError
[2015-01-23 10:26:02,968] sfml-jair.local/INFO/locust.runners: All locusts hatched: InstaEDUUser: 1
[2015-01-23 10:26:02,968] sfml-jair.local/INFO/locust.runners: Resetting stats

It seems to be related with a breaking change in Python 2.7.9 http://bugs.python.org/issue22438 that causes a problem in gevent gevent/gevent#477

@ghost
Copy link

ghost commented Jan 23, 2015

That's right. Try 2.7.7. I have been using pyenv for Python version management.

@jairtrejo
Copy link
Author

Thanks! Will do.

I updated the stack trace because I had pasted the wrong one. Feel free to close the issue, but it might be good to keep it around as reference.

@heyman
Copy link
Member

heyman commented Jan 23, 2015

Yeah, we'll close it once it has been resolved by gevent.

@seanadkinson
Copy link

Trying to get this working with SSL. Installed pyenv and downgraded to 2.7.7. Getting this on pip install locustio:

Installing collected packages: greenlet, msgpack-python, requests, flask, gevent, locustio
  Running setup.py install for greenlet
    building 'greenlet' extension
    clang -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/seanadkinson/.pyenv/versions/2.7.7/include/python2.7 -c greenlet.c -o build/temp.macosx-10.10-x86_64-2.7/greenlet.o
    clang -bundle -bundle_loader python.exe -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/seanadkinson/.pyenv/versions/2.7.7/lib build/temp.macosx-10.10-x86_64-2.7/greenlet.o -o build/lib.macosx-10.10-x86_64-2.7/greenlet.so
    ld: file not found: python.exe
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'clang' failed with exit status 1
    Complete output from command /Users/seanadkinson/.pyenv/versions/2.7.7/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/zp/2txhgsjj3sg6yrstr1gm1fnr0000gn/T/pip-build-2sHSIR/greenlet/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/zp/2txhgsjj3sg6yrstr1gm1fnr0000gn/T/pip-PeEoqU-record/install-record.txt --single-version-externally-managed --compile:
    running install

    running build

    running build_ext

    building 'greenlet' extension

    creating build

    creating build/temp.macosx-10.10-x86_64-2.7

    clang -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/seanadkinson/.pyenv/versions/2.7.7/include/python2.7 -c greenlet.c -o build/temp.macosx-10.10-x86_64-2.7/greenlet.o

    creating build/lib.macosx-10.10-x86_64-2.7

    clang -bundle -bundle_loader python.exe -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/seanadkinson/.pyenv/versions/2.7.7/lib build/temp.macosx-10.10-x86_64-2.7/greenlet.o -o build/lib.macosx-10.10-x86_64-2.7/greenlet.so

    ld: file not found: python.exe

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    error: command 'clang' failed with exit status 1

    ----------------------------------------
    Command "/Users/seanadkinson/.pyenv/versions/2.7.7/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/zp/2txhgsjj3sg6yrstr1gm1fnr0000gn/T/pip-build-2sHSIR/greenlet/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/zp/2txhgsjj3sg6yrstr1gm1fnr0000gn/T/pip-PeEoqU-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/zp/2txhgsjj3sg6yrstr1gm1fnr0000gn/T/pip-build-2sHSIR/greenlet

Any guidance?

Strange for it to be looking for python.exe when I am on Mac OS X

@ghost
Copy link

ghost commented Feb 28, 2015

This page may help related to pyenv and common build problems:
https://github.com/yyuu/pyenv/wiki/Common-build-problems

@danhanly
Copy link

danhanly commented May 27, 2016

@aidylewis how do I force locust to use a specific version of python? I've used pyenv shell 2.7.7 and pyenv global 2.7.7 but whenever I try and run my locust version I get the following in the error stack: File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 352, in wrap_socket which suggests it's still using 2.7.11

@justiniso
Copy link
Member

This should be resolved, but please raise again if you see it again.

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

5 participants