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

0.38 - Websockets error: object has no attribute 'drain' #5887

Closed
christopherbruce opened this issue Feb 12, 2017 · 12 comments
Closed

0.38 - Websockets error: object has no attribute 'drain' #5887

christopherbruce opened this issue Feb 12, 2017 · 12 comments

Comments

@christopherbruce
Copy link

Home Assistant release (hass --version):
0.38

Python release (python3 --version):
3.4.2

Component/platform:

  • http
  • websocket_api

Description of problem:
When I try to access the frontend, I enter my password and see a "Loading Data" screen that doesn't load anything. I just updated to 0.38 and was able to access once, but after a restart I haven't been able to get back in. Configuration shows no errors, home-assistant.log shows the error below repeating every second.

Expected:
Should be able to access frontend, should not receive websockets error.

Problem-relevant configuration.yaml entries and steps to reproduce:

  1. Install 0.38 update
  2. Restart system
  3. Attempt login to frontend

Traceback (if applicable):

17-02-11 20:55:12 ERROR (MainThread) [homeassistant.components.websocket_api] Unexpected error inside websocket API. {'type': 'get_states', 'id': 3}
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/websocket_api.py", line 282, in handle
    getattr(self, handler_name)(msg)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/websocket_api.py", line 398, in handle_get_states
    self.hass.states.async_all()))
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/websocket_api.py", line 220, in send_message
    self.wsock.send_json(message, dumps=JSON_DUMP)
  File "/home/homeassistant/.homeassistant/deps/aiohttp/web_ws.py", line 205, in send_json
    return self.send_str(dumps(data))
  File "/home/homeassistant/.homeassistant/deps/aiohttp/web_ws.py", line 194, in send_str
    return self._writer.send(data, binary=False)
  File "/home/homeassistant/.homeassistant/deps/aiohttp/_ws_impl.py", line 377, in send
    return self._send_frame(message, WSMsgType.TEXT)
  File "/home/homeassistant/.homeassistant/deps/aiohttp/_ws_impl.py", line 354, in _send_frame
    return self.writer.drain()
AttributeError: '_SelectorSocketTransport' object has no attribute 'drain'

Additional info:

Some errors in the Chrome console:

Uncaught (in promise) undefined
(anonymous) @ core-adfeb51….js:1
(index):1 Uncaught (in promise) Objecterror: Objectcode: 3message: "Connection lost"__proto__: Objectsuccess: falsetype: "result"__proto__: Object
core-adfeb51….js:1 Uncaught (in promise) DOMException: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).
(anonymous) @ core-adfeb51….js:1
inject.js:56 Capturing clicks
shared.js:213 GET https://api.fixer.io/latest?base=USD&symbols=GBP,EUR,JPY 403 (Forbidden)
fetchJSONFile @ shared.js:213
(anonymous) @ shared.js:175
target.(anonymous function) @ extensions::SafeBuiltins:19
safeCallbackApply @ VM1839 extensions::sendRequest:21
handleResponse @ VM1839 extensions::sendRequest:74
@balloob
Copy link
Member

balloob commented Feb 12, 2017

Please remove your <config>/deps folder and try again.

@balloob
Copy link
Member

balloob commented Feb 12, 2017

Sorry, correction: remove <config>/deps/aiohttp* (any folder that starts with aiohttp)

@christopherbruce
Copy link
Author

That did it, thanks Paulus. Is this clearing the deps always required when updating?

@balloob
Copy link
Member

balloob commented Feb 12, 2017

It's related to a bug that we already had but is sadly being discovered in 0.38. We're working on a fix.

@balloob balloob changed the title Websockets error and unable to access frontend Websockets error: object has no attribute 'drain' Feb 12, 2017
@balloob balloob changed the title Websockets error: object has no attribute 'drain' 0.38 - Websockets error: object has no attribute 'drain' Feb 12, 2017
@balloob
Copy link
Member

balloob commented Feb 12, 2017

0.38.1 should be out shortly with a temporary fix for this issue.

@brianjking
Copy link

@balloob No need to delete the /deps/aiohttp* once 0.38.1 is released?

@brianjking
Copy link

@balloob -- Even after upgrading to 0.38.1 I'm seeing this:

https://gist.github.com/brianjking/85eeffb30e6423742e719bb83f45b63e

@balloob
Copy link
Member

balloob commented Feb 12, 2017

@brianjking are you using a server like nginx in between?

@brianjking
Copy link

@balloob Yes, I'm using this NGINX setup.

My configuration files are here.

@balloob
Copy link
Member

balloob commented Feb 12, 2017

You have not correctly setup your NGINX to forward websocket connections. See https://home-assistant.io/ecosystem/nginx/

@brianjking
Copy link

brianjking commented Feb 12, 2017 via email

@balloob
Copy link
Member

balloob commented Feb 12, 2017

The difference in 0.38 is that we do everything through the websocket instead of falling back to event stream and Rest API. Your setup probably has been broken for a while.

@home-assistant home-assistant locked and limited conversation to collaborators May 19, 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

No branches or pull requests

3 participants