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

Migrate to cherrypy wsgi instead of eventlet #2387

Merged
merged 1 commit into from
Jun 30, 2016
Merged

Migrate to cherrypy wsgi instead of eventlet #2387

merged 1 commit into from
Jun 30, 2016

Conversation

balloob
Copy link
Member

@balloob balloob commented Jun 29, 2016

Description:
This migrates our WSGI server to use CherryPy instead of Eventlet. We tried a lot of approaches to get it to work but an asynchronous server just doesn't fare well with a threaded application as Home Assistant.

Things that are fixed now:

  • Camera streaming completely blocked any other request from happening.
  • Eventlet depended on greenlet which had a C-extension, causing installation troubles for people running it on Synology.
  • No HTTP responses handled while handling a service request that came in via API

Stays compatible with the SSL work of this release.

Related issue (if applicable): fixes #2329

Example entry for configuration.yaml (if applicable):

http:

Checklist:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@balloob
Copy link
Member Author

balloob commented Jun 29, 2016

CC @JshWright

@balloob balloob force-pushed the cherrypy-wsgi branch 4 times, most recently from ece9d42 to b83803a Compare June 29, 2016 06:05
@fabaff
Copy link
Member

fabaff commented Jun 29, 2016

Just a couple of observations:

  • Installation works flawless on Fedora in a venv
16-06-29 09:52:40 INFO (MainThread) [homeassistant.util.package] Attempting install of cherrypy==6.0.2
  • Traceback (only first start, could be a false-positive)
16-06-29 09:52:45 INFO (Timer) [homeassistant.core] Timer:starting
Exception in thread WSGI-server:
Traceback (most recent call last):
  File "/usr/lib64/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/home/fab/Documents/repos/home-assistant/homeassistant/components/http.py", line 314, in start
    from cherrypy import wsgiserver
ImportError: No module named 'cherrypy'
  • API works as expected
  • SSE works as well

No issues while running for a couple of hours.

@fabaff
Copy link
Member

fabaff commented Jun 29, 2016

And this traceback is gone too 😄

16-06-29 18:07:00 INFO (WSGI-server) [homeassistant.components.http] Traceback (most recent call last):
  File "/home/fab/.homeassistant/deps/eventlet/wsgi.py", line 506, in handle_one_response
    write(b''.join(towrite))
  File "/home/fab/.homeassistant/deps/eventlet/wsgi.py", line 453, in write
    wfile.flush()
  File "/usr/lib64/python3.4/socket.py", line 394, in write
    return self._sock.send(b)
  File "/home/fab/.homeassistant/deps/eventlet/greenio/base.py", line 379, in send
    return self._send_loop(self.fd.send, data, flags)
  File "/home/fab/.homeassistant/deps/eventlet/greenio/base.py", line 366, in _send_loop
    return send_method(data, *args)
BrokenPipeError: [Errno 32] Broken pipe

@balloob balloob force-pushed the cherrypy-wsgi branch 2 times, most recently from 0594504 to 84d57c2 Compare June 30, 2016 15:46
@balloob balloob merged commit d1f4901 into dev Jun 30, 2016
@balloob balloob deleted the cherrypy-wsgi branch June 30, 2016 16:02
@stjohnjohnson
Copy link
Contributor

So much <3

@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP stack stops responding for new requests after opening an MJPEG camera view
3 participants