Skip to content

Problem with socket monkeypatch #20

@jespino

Description

@jespino

Hi, I'm trying to port locust (http://github.com/locustio/locust) from python2 + gevent to python3 + guv, but I have a problem with the socket mockey patch.

I don't know how to solve it, but when i run the app, the IOClosed exceptions reach a socket library exceptions handler, and crash.

Without the sockets in the monkey patch everything works (in sync mode).

Here is the trackeback

Traceback (most recent call last):
File "/usr/lib64/python3.4/socket.py", line 374, in readinto
    return self._sock.recv_into(b)
File "/home/jespino/Projects/Terceros/guv/guv/greenio.py", line 200, in recv_into
    timeout_exc=s_timeout("timed out"))
File "/home/jespino/Projects/Terceros/guv/guv/greenio.py", line 54, in _trampoline
    raise IOClosed()
guv.exceptions.IOClosed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jespino/Projects/Terceros/guv/guv/hubs/pyuv_cffi.py", line 179, in poll_cb
    cb(*cb_args)
File "/home/jespino/Projects/Terceros/guv/guv/greenthread.py", line 151, in main
    result = function(*args, **kwargs)
File "/home/jespino/Projects/Github/locust/locust/runners.py", line 112, in start_locust
    locust().run()
File "/home/jespino/Projects/Github/locust/locust/core.py", line 104, in run
    self.task_set(self).run()
File "/home/jespino/Projects/Github/locust/locust/core.py", line 251, in run
    self.on_start()
File "/home/jespino/Projects/Github/taiga/taiga-extras/load-test/locustfile.py", line 16, in on_start
    response = self.client.get("/api/v1/tasks?project={}".format(self._projects[0].get('id')), headers=self._auth_headers)
File "/home/jespino/.virtualenvs/taiga-tribe/lib/python3.4/site-packages/requests-2.6.0-py3.4.egg/requests/sessions.py", line 476, in get
    return self.request('GET', url, **kwargs)
File "/home/jespino/Projects/Github/locust/locust/clients.py", line 113, in request
    response = self._send_request_safe_mode(method, url, **kwargs)
File "/home/jespino/Projects/Github/locust/locust/clients.py", line 157, in _send_request_safe_mode
    return requests.Session.request(self, method, url, **kwargs)
File "/home/jespino/.virtualenvs/taiga-tribe/lib/python3.4/site-packages/requests-2.6.0-py3.4.egg/requests/sessions.py", line 464, in request
    resp = self.send(prep, **send_kwargs)
File "/home/jespino/.virtualenvs/taiga-tribe/lib/python3.4/site-packages/requests-2.6.0-py3.4.egg/requests/sessions.py", line 613, in send
    r.content
File "/home/jespino/.virtualenvs/taiga-tribe/lib/python3.4/site-packages/requests-2.6.0-py3.4.egg/requests/models.py", line 733, in content
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
File "/home/jespino/.virtualenvs/taiga-tribe/lib/python3.4/site-packages/requests-2.6.0-py3.4.egg/requests/models.py", line 656, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
File "/home/jespino/.virtualenvs/taiga-tribe/lib/python3.4/site-packages/requests-2.6.0-py3.4.egg/requests/packages/urllib3/response.py", line 273, in stream
    data = self.read(amt=amt, decode_content=decode_content)
File "/home/jespino/.virtualenvs/taiga-tribe/lib/python3.4/site-packages/requests-2.6.0-py3.4.egg/requests/packages/urllib3/response.py", line 203, in read
    data = self._fp.read(amt)
File "/usr/lib64/python3.4/http/client.py", line 500, in read
    return super(HTTPResponse, self).read(amt)
File "/usr/lib64/python3.4/http/client.py", line 539, in readinto
    n = self.fp.readinto(b)
File "/usr/lib64/python3.4/socket.py", line 381, in readinto
    if e.args[0] in _blocking_errnos:
IndexError: tuple index out of range
Exception while removing listener: 'NoneType' object has no attribute 'ref'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions