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.server] aiohttp.http_exceptions.BadStatusLine: invalid HTTP method #13172

Closed
keitetran opened this issue Mar 13, 2018 · 37 comments
Closed
Labels

Comments

@keitetran
Copy link

keitetran commented Mar 13, 2018

Home Assistant release (hass --version):
0.64.1 => 0.65.4

Python release (python3 --version):
3.5.x

Component/platform:
aiohttp.server

Description of problem:
[aiohttp.server] Error handling request

Expected:
NO

Traceback (if applicable):

2018-03-13 20:34:04 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web_protocol.py", line 272, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp\_http_parser.pyx", line 295, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method
2018-03-13 20:34:04 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/aiohttp/web_protocol.py", line 272, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp\_http_parser.pyx", line 295, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method
@silversegarra
Copy link

silversegarra commented Mar 13, 2018

Same to me... without update 0.64.3

@mrfoxbit
Copy link

Same with me

Hassbian: 0.65.4
python3: 3.6.3
aiohttp: 3.0.6
aiohttp-cors: 0.6.0

@silversegarra
Copy link

I hope, someone can help us

@keitetran
Copy link
Author

Update lastest python to fix. This guild is python version 3.6.0
https://gist.github.com/dschep/24aa61672a2092246eaca2824400d37f

Change with this link
https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz

@silversegarra
Copy link

Thanks

@mrfoxbit
Copy link

mrfoxbit commented Mar 15, 2018

It did not worked. still issue on python version 3.6.4 and HA version 0.65.5

2018-03-15 11:14:03 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 231, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp\_http_parser.pyx", line 295, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method

@vpomax
Copy link

vpomax commented Mar 25, 2018

I have the same problem...
Home Assistant 0.65.6
Hassio 0.99

2018-03-25 19:58:05 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 231, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp\_http_parser.pyx", line 295, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method

@rbflurry
Copy link
Contributor

rbflurry commented Apr 5, 2018

Same issues here HASS 0.66.1 to be honest I have seen it for a while now.
Python 3.5.3

Previous research had pushed me towards an Nginx/hass issue and I ended up specifying my URL in the hass configuration but that has not made a difference.

Is anyone else also using Nginx?

@ludeeus
Copy link
Member

ludeeus commented Apr 7, 2018

I aslo run NGINX, I see this issue with my docker install but not on my VM.

@gb53smith
Copy link

gb53smith commented Jul 4, 2018

Same issue here with HASS0.72.1 with addons DUCKDNS, DNSMASQ, MQTT, SSH and NGINX.
I forward 80:80 and 443:443 on my router
Using NGINX got rid of this error:
Error doing job: Task was destroyed but it is pending!
But now I have a burst of this topics' error messages about once a day.
Edit on July 14
I no longer see this error. No changes made on my part. Perhaps the Hass.io supervisor has been fixed.

@keitetran
Copy link
Author

i was fixed this error with upgrade pip3 to newest version, then update HA to newest version. All work ok without error on log.

@rbflurry
Copy link
Contributor

rbflurry commented Jul 9, 2018

@keitetran What commands did you use to update pip3? I want to try that as well.

@keitetran
Copy link
Author

keitetran commented Jul 9, 2018

I see pip. Other component on HA need other heigher version, but pip3 version is low. That was not upgraded => some component not working fine.
You need upgrade python then upgrade pip3 => all component up to lastest.
Maybe my step can wrong, but my error was fixed. 😟

Note. Upgrade pip3 with hass user. Not user pi. Im used hassbian.
https://www.raspberrypi.org/forums/viewtopic.php?t=177711

@Imperial-Guard
Copy link

Imperial-Guard commented Jul 14, 2018

Same issue here:

Home Assistant 0.73.1

Hostname hassio
System HassOS 1.5
Deployment production
Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 230, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 297, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method

@tjorim
Copy link
Contributor

tjorim commented Jul 17, 2018

Same issue and error log as @Imperial-Guard;
fully clean and fresh install, nothing setup yet.

System: HassOS 1.7
Hass.io supervisor: 115
Home Assistant: 0.73.2 (also noticed before the upgrade from 0.73.1

@rbflurry
Copy link
Contributor

Any update here? I know I am still seeing the issue even on the latest.

@rbflurry
Copy link
Contributor

Did some more digging and found this to be true.
https://community.home-assistant.io/t/error-mainthread-aiohttp-server-error-handling-request/19659/9?u=rabittn

I still had other services (blue iris) pointed directly at the HASS IP address trying to use https.

@balloobbot
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍

@Csepi
Copy link

Csepi commented Nov 5, 2018

Hi!

I still have this issue:
System: Docker
Version: 0.81.6

I only use http, no https.

Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 242, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 523, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method

@laenbdarceq
Copy link

laenbdarceq commented Nov 9, 2018

Hello,

I also still see the issue :

System: Raspbian
Hass version: 0.81.6
python version : 3.5.3
Lovelace ui (if relevant)

Full traceback:
error-handling-request.log

@mostlymetalman
Copy link

FWIW. I was having this issue getting while I'm still getting everything set up. I was using someone else's docker-compose.yml and just noticed the health check for home assistant hits an https URL. Changing that to HTTP (for now until I get https set up) fixed the issue.

@Bodge-IT

This comment has been minimized.

@sharkpunch5
Copy link

sharkpunch5 commented Jan 9, 2019

hi all - i fixed this by adding the full address of the site into the http: component under base_url
I believe the error comes is caused in most instances by using https without having this set in the configuration.yaml

http:
  base_url: https://hass.example.com

@Bodge-IT
Copy link

Bodge-IT commented Jan 9, 2019

Not using SSL and have full url in config but no longer seeing this issue in current ver 85.0b0

@dmwyatt
Copy link
Contributor

dmwyatt commented Jan 22, 2019

@Bodge-IT What makes you think that error has anything to do with the one this issue is about?

@Bodge-IT
Copy link

Bodge-IT commented Jan 23, 2019 via email

@dmwyatt
Copy link
Contributor

dmwyatt commented Jan 24, 2019

@Bodge-IT Because this is not a technical support forum. While it's nice that you no longer have the problem, it is not really relevant here. This is an issue tracker for the developers. If you have other information that indicates that the error you posted is related to the error this issue is about, then it would be helpful to include that information so we can track down the source of this potential bug.

@Bodge-IT
Copy link

I wasn't asking for technical support. The reason why I thought it was related was because it had the same error message.

@gb53smith
Copy link

@Bodge-IT You have a recorder error.
Try stopping HA, deleting home-assistant_v2.db and starting HA
Otherwise, try the NGNIX add-on as this will bypass the aiohttp server.

@dmwyatt
Copy link
Contributor

dmwyatt commented Jan 25, 2019

If I turn on debug logging for everything I do not get any more information from aiohttp to help diagnose this issue. However, every time I see this in my logs the previous two lines in the log are:

2019-01-25 12:14:26 DEBUG (Thread-5) [sseclient] Dispatching keep-alive event, 4 bytes...
2019-01-25 12:14:26 DEBUG (Thread-5) [nest.nest] <<< keep-alive event

@keitetran I recommend changing the title of this issue to something like "aiohttp.http_exceptions.BadStatusLine: invalid HTTP method" as that is the relevant line from the error.

@ddppddpp
Copy link

ddppddpp commented Feb 1, 2019

hitting this error when trying to access https://ip.address:8123
HASSIO with HA 0.86.4 RPi 3.
ssl self-signed certs installed and base_usr points to https://ip.address

@cdrom1028

This comment has been minimized.

@awarecan awarecan changed the title [aiohttp.server] Error handling request [aiohttp.server] aiohttp.http_exceptions.BadStatusLine: invalid HTTP method Apr 30, 2019
@utamir
Copy link

utamir commented May 22, 2019

Still an issue
0.93.1 hassio

@ziptbm
Copy link

ziptbm commented Jun 27, 2019

Just upgraded to 0.95 and I'm now seeing this error, but did not see (or notice it) previously. Currently shows this error hitting 85 times since my upgrade.

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 275, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 523, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method

@balloob
Copy link
Member

balloob commented Jun 27, 2019

This usually means that if you’re using SSL, someone is connecting to Home Assistant using http://, or the other way around. Check your scripts and Hass.io add-on configurations.

@cnorred
Copy link

cnorred commented Jul 14, 2019

If you're experiencing this issue after enabling SSL/TLS in your configuration.yaml file, and these errors are being generated when you attempt to visit your HA via HTTPS://URL:8123.

I would look at your configuration.yaml and make sure spacing is correct.

3 ticks after http for the SSL data. [space] = Space Bar

http:
[space][space][space]ssl_certificate: file/path
[space][space][space]ssl_key: file/path
[space][space][space]base_url: https://domain.com

@stale
Copy link

stale bot commented Oct 17, 2019

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 17, 2019
@stale stale bot closed this as completed Oct 24, 2019
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