Getting h2.exceptions.ProtocolError when using httpx with http2 #897
Replies: 2 comments
-
|
Note that this occurs when the timeout is set to |
Beta Was this translation helpful? Give feedback.
-
|
I have another occurrence of this: DescriptionWhen an This causes the raw Current BehaviorIn except BaseException as exc:
# ... cleanup ...
if isinstance(exc, h2.exceptions.ProtocolError):
if self._connection_terminated:
raise RemoteProtocolError(self._connection_terminated)
raise LocalProtocolError(exc)
raise excHowever, in except BaseException as exc:
with AsyncShieldCancellation():
await self.aclose()
raise exc # <-- No wrapping of h2.exceptions.ProtocolErrorSteps to Reproduce
Example TracebackExpected BehaviorThe exception handling in except BaseException as exc:
with AsyncShieldCancellation():
await self.aclose()
if isinstance(exc, h2.exceptions.ProtocolError):
if self._connection._connection_terminated:
raise RemoteProtocolError(self._connection._connection_terminated)
raise LocalProtocolError(exc)
raise excThis would ensure consistent exception handling regardless of whether the error occurs during the initial request/response or during body streaming. Impact
Environment
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I believe I've hit another case related to this existing issue: #679.
Here is my stack:
My current workaround is to add this exception to tenacity.retry(), but ideally this exception is properly wrapped in httpcore.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions