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

aiohttp #108533

Closed
wernerhp opened this issue Jan 20, 2024 · 8 comments
Closed

aiohttp #108533

wernerhp opened this issue Jan 20, 2024 · 8 comments

Comments

@wernerhp
Copy link

The problem

Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:421
First occurred: 21:03:44 (87 occurrences)
Last logged: 21:18:11

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 350, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
  Invalid method encountered:

    b'\x16\x03\x01\x02\x9b\x01'
      ^

What version of Home Assistant Core has the issue?

2024.1.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@joostlek
Copy link
Member

I am missing some context, can you elaborate?

@wernerhp
Copy link
Author

That's all that's available feom the error message in the logs.

@wernerhp
Copy link
Author

Trying to figure out what all these errors are and why they are occurring

Logger: homeassistant
Source: /usr/src/homeassistant/homeassistant/runner.py:145
First occurred: 17:25:44 (2 occurrences)
Last logged: 18:23:41

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 715, in ping
    await self._send_frame(message, WSMsgType.PING)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 682, in _send_frame
    self._write(header + message)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 702, in _write
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport

@codyc1515
Copy link
Contributor

Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:421
First occurred: 21:03:44 (87 occurrences)
Last logged: 21:18:11

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 350, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
  Invalid method encountered:

    b'\x16\x03\x01\x02\x9b\x01'
      ^

This happens when you try to speak HTTPS (443) to the HTTP port (8123). Maybe a more descriptive error message should be added for that method? Something about checking HTTP / Proxy configs.

Logger: homeassistant
Source: /usr/src/homeassistant/homeassistant/runner.py:145
First occurred: 17:25:44 (2 occurrences)
Last logged: 18:23:41

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 715, in ping
    await self._send_frame(message, WSMsgType.PING)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 682, in _send_frame
    self._write(header + message)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 702, in _write
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport

This happens when your connection to HA breaks, perhaps your phones Wi-Fi disconnected suddenly, and the connection could not be closed cleanly. This could probably be handled better too - it's not really an error, in most cases.

@wernerhp
Copy link
Author

Ok, yeah, more descriptive errors would be appreciated. Would be nice if the request could be logged so I known what's calling 8123 with over HTTPS so it can be migrated. (I recently switched from certs on the HA instance to the nginx addon, so what you're suggesting makes sense, but need a way to identify the offending call)

@wernerhp
Copy link
Author

Getting a bunch of these also during the night, which is strange, but from tour feedback , my best guess that the wifi dropped. Can't imagine why though. Auto Channel switching perhaps?

Logger: pychromecast.socket_client
Source: /usr/local/lib/python3.11/site-packages/pychromecast/socket_client.py:398
First occurred: 01:41:02 (5 occurrences)
Last logged: 04:20:52

[Assistant speakers(192.168.30.162):32136] Failed to connect to service ServiceInfo(type='host', data=('192.168.30.162', 32136)), retrying in 5.0s
[All Speakers(192.168.30.162):32065] Failed to connect to service ServiceInfo(type='host', data=('192.168.30.162', 32065)), retrying in 5.0s
[Assistant speakers(192.168.30.163):32136] Failed to connect to service ServiceInfo(type='host', data=('192.168.30.163', 32136)), retrying in 5.0s
[All Speakers(192.168.30.163):32065] Failed to connect to service ServiceInfo(type='host', data=('192.168.30.163', 32065)), retrying in 5.0s
[Kitchen speaker(192.168.30.163):8009] Failed to connect to service ServiceInfo(type='host', data=('192.168.30.163', 8009)), retrying in 5.0s

@codyc1515
Copy link
Contributor

This is a completely different integration and not related to aiohttp. If they all went unavailable at the same time, I would certainly check Wi-Fi but this message can sometimes be misleading with the 5 occurences as it shows them together but you can see that the issue first occured at a different time to last occured, so may not be wifi In any case, a new issue should be logged.

@joostlek
Copy link
Member

I tried checking with some others if we could make a nicer error for this, but apparently we can't. Since the issue has been resolved for you I'll close this issue.

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