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._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadHttpMessage: 400, message: #10331

Open
1 task done
skywalker0403 opened this issue Jan 19, 2025 · 16 comments
Labels

Comments

@skywalker0403
Copy link

Describe the bug

I keep getting the above error message. This message accumulates to several hundred a day if I don't delete it in between. I have restored backups from the last 10 days so that I could perhaps rule out an update. Unfortunately, this was unsuccessful. The only update I could think of would be the first HA update this year. I don't know if there was another one. I don't have Duck DNS or anything similar to access my system from outside, I use VPN on my iPhone via the FritzBox instead. I don't know what to do anymore, especially since I can't do anything with this message because I don't know anything about Linux. I read about a similar problem here, but it was closed. There was no solution for me

To Reproduce

As already described, I have 10 backup days and used the first backup of the 10, but the error was already there at that time.

Expected behavior

By rewinding I hoped to find an update as the cause. Without success

Logs/tracebacks

Logger: aiohttp.server
Quelle: /usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py:451
Erstmals aufgetreten: 10:32:32 (5 Vorkommnisse)
Zuletzt protokolliert: 10:32:37

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 380, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "aiohttp/_http_parser.pyx", line 558, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message:
  Data after `Connection: close`:

    b'\x00'
          ^

Python Version

3.13.1

aiohttp Version

-

multidict Version

-

propcache Version

-

yarl Version

-

OS

System Information

version core-2025.1.2
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.13.1
os_name Linux
os_version 6.6.66-haos
arch x86_64
timezone Europe/Berlin
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
HACS Data ok
GitHub API Calls Remaining 4971
Installed Version 2.0.3
Stage running
Available Repositories 1503
Downloaded Repositories 31
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 14.1
update_channel stable
supervisor_version supervisor-2024.12.3
agent_version 1.6.0
docker_version 27.2.0
disk_total 115.4 GB
disk_used 9.4 GB
healthy true
supported true
host_connectivity true
supervisor_connectivity true
ntp_synchronized true
virtualization
board generic-x86-64
supervisor_api ok
version_api ok
installed_addons Advanced SSH & Web Terminal (20.0.0), File editor (5.8.0), Home Assistant Google Drive Backup (0.112.1), Samba share (12.4.0), Mosquitto broker (6.5.0), Zigbee2MQTT (2.0.0-2), Matter Server (7.0.0), Home-Assistant-Matter-Hub (3.0.0-alpha.62)
Dashboards
dashboards 5
resources 21
views 16
mode storage
Recorder
oldest_recorder_run 2. Januar 2025 um 22:41
current_recorder_run 19. Januar 2025 um 10:29
estimated_db_size 226.85 MiB
database_engine sqlite
database_version 3.47.1

Related component

Server, Client

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@Dreamsorcerer
Copy link
Member

Dreamsorcerer commented Jan 19, 2025

Seems like you have some device that is sending bad HTTP messages (specifically trying to close a connection and then sending a null byte). I thought @bdraco had quietened the error messages though, so they weren't meant to create so much noise.

Do you have a reverse proxy like nginx with keepalive enabled? That would stop the workaround that @bdraco added from working (we can probably allow a more robust solution with middlewares once #3287 is done).

@skywalker0403
Copy link
Author

Hi, I don't know what a reverse proxy is. Also what the night, no idea. What I know is that I tried everything possible today. In addition, I have stopped add-ons like Mqtt or Google Backup to maybe find a direction where it comes from, but all without success. I had Motion Eye in use, because of the webhook stuff then completely deleted. But that's not it. It's not Samba either. What's new is that I exchanged two lamps for Zigbee. Everything else stayed that way. I have installed a new camera (TP-Link) but it is via Webrtc in the network without integration. I'm still going crazy. The last possibility would be a new installation and then backup. But I think the mistake will come along

@bdraco
Copy link
Member

bdraco commented Jan 19, 2025

We only downgraded logging for invalid first bytes. It looks like this one is getting far enough that the http request is partially valid so we get a log message at that level. We likely need to improve the logging to show the host responsible for sending the invalid request.

For Home Assistant users it's usually an ONVIF webhook from some cheap non compliant camera that causes the log spam

@skywalker0403
Copy link
Author

I have completely removed the camera from the system (the old one) the new one is a TP Link. This is integrated via Webrtc. But, that's the point, the reports already came in front of the new camera. At first I thought it was because of that and took them out again and additionally deleted OnVif. But the mistake still comes. I have really deactivated everything one after the other piece by piece today, yet the message came back.

@bdraco
Copy link
Member

bdraco commented Jan 19, 2025

You'll probably unplug the offending device since once the subscription starts it might take a day to expire

@skywalker0403
Copy link
Author

I don't know which one to unplug. There are too many and I don't know where to start. What I know is that the message comes massively and frequently. I have now deactivated the Alexa integration. Let's see what happens.

@skywalker0403
Copy link
Author

Hi, frankly my question would be, should I do something with this code cover? I stopped reading after the second section. I have no plan at all and don't understand anything about what they want.

@Dreamsorcerer
Copy link
Member

I'm not sure what you're trying to do. If the only issue is that those errors appear in the logs, then you can just ignore them, they probably shouldn't be causing you any issues.

@skywalker0403
Copy link
Author

I'm not sure what you're trying to do. If the only issue is that those errors appear in the logs, then you can just ignore them, they probably shouldn't be causing you any issues.

Hi, if I don't delete the error, then as I just saw hundreds of incidents within a few hours, but that's no use if something here permanently tries to reach a device. This can only be at the expense of the entire network. I want to be able to rely on everything working and not being hindered by such a mistake. I'm not sure if I can just ignore it.

@Dreamsorcerer
Copy link
Member

A client is sending an extra byte after closing the connection. That byte doesn't appear to have any significance and the connection has still been closed successfully. There is no "expense" to the network or anything else to be concerned about. If you can narrow down what is sending the bad message, maybe you can try and fix it. But, if it's caused by some cheap device as mentioned above, there's nothing you can do about it other than buying a better device.

@skywalker0403
Copy link
Author

Okay, I can live with that. However, the event must have come with some update. The system as it is now has been running smoothly for over a year. What's new are two Zigbee bulbs that run over zigbee2mqtt. Zigbee2Mgtt has been running for 6 months without any problems. Unfortunately, I can no longer trace when exactly this event occurred. This can actually only have been on the last update from HA. Otherwise I still have HomeAssistant Matter Hub and Livisi Unofficial. The latter also ran almost without problems so far. There is a switch that is quite far from the hub, which is not reachable from time to time. I can not deactivate Livisi, our heating, light switches, window sensors and motion detectors run over it. Everything else that is running with me I have already deactivated and checked whether an error is provoked. I have deactivated the Zigbee lamps that are new, errors still come.

@Dreamsorcerer
Copy link
Member

Aiohttp is an HTTP client/server. Zigbee is completely unrelated to us, so I can't imagine it has anything to do with those devices. It's possible that some more strict parsing on our side resulted in the errors recently (I recall a security issue relating to it that we fixed), where previously the messages were being allowed without errors. So, it may be a device or API that has been behaving badly for years and we only just started producing the error.

@skywalker0403
Copy link
Author

Hi, in my desperation to find the error, I also flattened Zigbee. Then it can only be Tuya or WiZ. Although I had already deactivated Tuya. Maybe not long enough. WiZ has just come into my head, that would be the only integration I have ignored. The world doesn't depend on it. I'll deactivate that right away.

@skywalker0403
Copy link
Author

Probably the error would come with a new HA OS installation, right?

@skywalker0403
Copy link
Author

Hi, I just thought of something because I'm thinking of setting up HA again and installing a backup. I installed Tapo Cameracontroll for my new TP-Link camera. Now it would be possible that the drivers(?) Or any fragments have stuck and cause this error. Would that be possible? Then I'll make the effort and set it up again.

@skywalker0403
Copy link
Author

Hi, I have reset the system but the error has come with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants