fix: handle ClosedResourceError in StreamableHTTP message router (#1384)
Co-authored-by: Max Isbey <224885523+maxisbey@users.noreply.github.com> Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
This commit is contained in:
parent
72a34002aa
commit
9ed0b93ceb
1 changed files with 284 additions and 1 deletions
|
|
@ -1000,11 +1000,16 @@ class StreamableHTTPServerTransport:
|
|||
# Stream might be closed, remove from registry
|
||||
self._request_streams.pop(request_stream_id, None)
|
||||
else:
|
||||
logging.debug(
|
||||
logger.debug(
|
||||
f"""Request stream {request_stream_id} not found
|
||||
for message. Still processing message as the client
|
||||
might reconnect and replay."""
|
||||
)
|
||||
except anyio.ClosedResourceError:
|
||||
if self._terminated:
|
||||
logger.debug("Read stream closed by client")
|
||||
else:
|
||||
logger.exception("Unexpected closure of read stream in message router")
|
||||
except Exception:
|
||||
logger.exception("Error in message router")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue