You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The bug is reproducible against the latest release or master.
There are no similar issues or pull requests to fix it yet.
Describe the bug
Today I stumbled on a really weird error with httpx and uvicorn. Unable to reproduce locally, have some clues, but can't figure it out... So I decided to create a bug report here.
I am running micro services on EKS with following setup:
Nginx Ingress -> Service 1 -> Service 2
Service 1 will call Service 2 with httpx, Service 2 serves a fastapi app with uvicorn.
When I call Service 1 that calls Service 2 ~ 1/3 calls results in a 500 RemoteProtocolError. Super weird.
{"asctime": "2022-01-31 17:28:41", "levelname": "WARNING", "module": "h11_impl", "funcName": "handle_events", "lineno": 139, "message": "Invalid HTTP request received.", "exc_info": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py\", line 136, in handle_events\n event = self.conn.next_event()\n File \"/usr/local/lib/python3.9/site-packages/h11/_connection.py\", line 443, in next_event\n exc._reraise_as_remote_protocol_error()\n File \"/usr/local/lib/python3.9/site-packages/h11/_util.py\", line 76, in _reraise_as_remote_protocol_error\n raise self\n File \"/usr/local/lib/python3.9/site-packages/h11/_connection.py\", line 425, in next_event\n event = self._extract_next_receive_event()\n File \"/usr/local/lib/python3.9/site-packages/h11/_connection.py\", line 367, in _extract_next_receive_event\n event = self._reader(self._receive_buffer)\n File \"/usr/local/lib/python3.9/site-packages/h11/_readers.py\", line 72, in maybe_read_from_IDLE_client\n matches = validate(\n File \"/usr/local/lib/python3.9/site-packages/h11/_util.py\", line 88, in validate\n raise LocalProtocolError(msg)\nh11._util.RemoteProtocolError: illegal request line: bytearray(b'{\"foo\": \"bar\"}POST /v1/api/x HTTP/1.1')"}
Service 2 spits out:
{
"asctime": "2022-01-31 17:28:41",
"levelname": "WARNING",
"module": "h11_impl",
"funcName": "handle_events",
"lineno": 139,
"message": "Invalid HTTP request received.",
"exc_info": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py\", line 136, in handle_events\n event = self.conn.next_event()\n File \"/usr/local/lib/python3.9/site-packages/h11/_connection.py\", line 443, in next_event\n exc._reraise_as_remote_protocol_error()\n File \"/usr/local/lib/python3.9/site-packages/h11/_util.py\", line 76, in _reraise_as_remote_protocol_error\n raise self\n File \"/usr/local/lib/python3.9/site-packages/h11/_connection.py\", line 425, in next_event\n event = self._extract_next_receive_event()\n File \"/usr/local/lib/python3.9/site-packages/h11/_connection.py\", line 367, in _extract_next_receive_event\n event = self._reader(self._receive_buffer)\n File \"/usr/local/lib/python3.9/site-packages/h11/_readers.py\", line 72, in maybe_read_from_IDLE_client\n matches = validate(\n File \"/usr/local/lib/python3.9/site-packages/h11/_util.py\", line 88, in validate\n raise LocalProtocolError(msg)\nh11._util.RemoteProtocolError: illegal request line: bytearray(b'{\"foo\": \"bar\"}POST /v1/api/x HTTP/1.1')"
}
I tried the following to try and reproduce:
running both services on my machine (Arch Linux 5.15.13) - no result
running both services in docker on my machine - no result
running Service 1 on my machine and port forwarding Service 2 (kubefwd) - no result
So it has something to do with Service 1 running in Kuberentes? The odd thing is that I ran Service 2 with hypercorn and no random 500s everything works fine. So it has something to do with Service 2?
Conclusion, I am asking for help on ways to debug this anomaly. Any recommendations?
The text was updated successfully, but these errors were encountered:
sevaho
changed the title
How to debug random RemoteProtocolError: illegal request line: bytearray(b'{\"foo\": \"bar\"}POST /v1/api HTTP/1.1')" }
How to debug random RemoteProtocolError: illegal request line: bytearray(b'{\"foo\": \"bar\"}POST /v1/api/x HTTP/1.1')" }
Jan 31, 2022
Checklist
master
.Describe the bug
Today I stumbled on a really weird error with httpx and uvicorn. Unable to reproduce locally, have some clues, but can't figure it out... So I decided to create a bug report here.
I am running micro services on EKS with following setup:
Service 1 will call Service 2 with httpx, Service 2 serves a fastapi app with uvicorn.
When I call Service 1 that calls Service 2 ~ 1/3 calls results in a 500 RemoteProtocolError. Super weird.
I call with following script:
My script produces the following:
Service 1 error logs:
Service 2 spits out:
I tried the following to try and reproduce:
So it has something to do with Service 1 running in Kuberentes? The odd thing is that I ran Service 2 with
hypercorn
and no random 500s everything works fine. So it has something to do with Service 2?Conclusion, I am asking for help on ways to debug this anomaly. Any recommendations?
Steps to reproduce the bug
None, sorry. Cannot reproduce locally.
Expected behavior
No response
Actual behavior
No response
Debugging material
Running latest httpx, uvicorn, Python3.9, python:3.9-slim docker.
Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: