Aiohttp-Post-Anfrage h11._util.LocalProtocolError: Der Ereignistyp „ConnectionClosed“ kann nicht verarbeitet werden, wenPython

Python-Programme
Guest
 Aiohttp-Post-Anfrage h11._util.LocalProtocolError: Der Ereignistyp „ConnectionClosed“ kann nicht verarbeitet werden, wen

Post by Guest »

  • Ich verwende aiohttp==3.10.10 mit Python 3.8
  • Für den Kontext führe ich eine FastAPI-App aus und bei jeder Anfrage, die die App erhält Es erstellt eine asynchrone Hintergrundaufgabe, um eine Post-Anfrage an eine andere externe API zu senden.
  • Ich erstelle eine gemeinsame aiohttp.ClientSession für die Hintergrundaufgaben (ich benötige diese für das Verbindungspooling mit der anderen externen API).
  • Meistens funktioniert es, aber ich sehe einige Fehler bezüglich der Verbindungsschließung, während eine Nachricht übertragen wird

Code: Select all

"ERROR", "name": "asyncio", "lineno": 1707, "message": "Exception in callback H11Protocol.timeout_keep_alive_handler()
handle: ", "exc_info": "Traceback (most recent call last):
File "/usr/local/lib/python3.8/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 383, in timeout_keep_alive_handler
self.conn.send(event)
File "/usr/local/lib/python3.8/site-packages/h11/_connection.py", line 512, in send
data_list = self.send_with_data_passthrough(event)
File "/usr/local/lib/python3.8/site-packages/h11/_connection.py", line 537, in send_with_data_passthrough
self._process_event(self.our_role, event)
File "/usr/local/lib/python3.8/site-packages/h11/_connection.py", line 272, in _process_event
self._cstate.process_event(role, type(event), server_switch_event)
File "/usr/local/lib/python3.8/site-packages/h11/_state.py", line 293, in process_event
self._fire_event_triggered_transitions(role, _event_type)
File "/usr/local/lib/python3.8/site-packages/h11/_state.py", line 311, in _fire_event_triggered_transitions
raise LocalProtocolError(
h11._util.LocalProtocolError: can't handle event type ConnectionClosed when role=SERVER and state=SEND_BODY"}
Ist das schon mal jemandem aufgefallen? Oder wissen Sie eine Lösung dafür?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post