Drop `trio`-exc-catching if tpt-closed covers them
Remove the `trio.ClosedResourceError` and `trio.BrokenResourceError` handling that should now be subsumed by `TransportClosed` re-raising out of the `.ipc` stack. Deats, - drop CRE and BRE from `._streaming.MsgStream.aclose()/.send()` blocks. - similarly rm from `._context.open_context_from_portal()`. - also from `._portal.Portal.cancel_actor()` and drop the (now-completed-todo) comment about this exact thing. Also add comment in `._rpc.try_ship_error_to_remote()` noting the remaining `trio` catches there are bc the `.ipc` layers *should* be wrapping them; thus `log.critical()` use is warranted. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-codetpt_tolerance
parent
50f40f427b
commit
07c2ba5c0d
|
|
@ -2429,11 +2429,7 @@ async def open_context_from_portal(
|
|||
try:
|
||||
# await pause(shield=True)
|
||||
await ctx.cancel()
|
||||
except (
|
||||
trio.BrokenResourceError,
|
||||
trio.ClosedResourceError,
|
||||
TransportClosed,
|
||||
):
|
||||
except TransportClosed:
|
||||
log.warning(
|
||||
'IPC connection for context is broken?\n'
|
||||
f'task: {ctx.cid}\n'
|
||||
|
|
|
|||
|
|
@ -329,18 +329,7 @@ class Portal:
|
|||
# if we get here some weird cancellation case happened
|
||||
return False
|
||||
|
||||
except (
|
||||
# XXX, should never really get raised unless we aren't
|
||||
# wrapping them in the below type by mistake?
|
||||
#
|
||||
# Leaving the catch here for now until we're very sure
|
||||
# all the cases (for various tpt protos) have indeed been
|
||||
# re-wrapped ;p
|
||||
trio.ClosedResourceError,
|
||||
trio.BrokenResourceError,
|
||||
|
||||
TransportClosed,
|
||||
) as tpt_err:
|
||||
except TransportClosed as tpt_err:
|
||||
ipc_borked_report: str = (
|
||||
f'IPC for actor already closed/broken?\n\n'
|
||||
f'\n'
|
||||
|
|
|
|||
|
|
@ -935,6 +935,11 @@ async def try_ship_error_to_remote(
|
|||
|
||||
# XXX NOTE XXX in SC terms this is one of the worst things
|
||||
# that can happen and provides for a 2-general's dilemma..
|
||||
#
|
||||
# FURHTER, we should never really have to handle these
|
||||
# lowlevel excs from `trio` since the `Channel.send()` layers
|
||||
# downward should be mostly wrapping such cases in a
|
||||
# tpt-closed; the `.critical()` usage is warranted.
|
||||
except (
|
||||
trio.ClosedResourceError,
|
||||
trio.BrokenResourceError,
|
||||
|
|
|
|||
|
|
@ -410,10 +410,7 @@ class MsgStream(trio.abc.Channel):
|
|||
# it).
|
||||
with trio.CancelScope(shield=True):
|
||||
await self._ctx.send_stop()
|
||||
|
||||
except (
|
||||
trio.BrokenResourceError,
|
||||
trio.ClosedResourceError,
|
||||
TransportClosed,
|
||||
) as re:
|
||||
# the underlying channel may already have been pulled
|
||||
|
|
@ -595,8 +592,6 @@ class MsgStream(trio.abc.Channel):
|
|||
),
|
||||
)
|
||||
except (
|
||||
trio.ClosedResourceError,
|
||||
trio.BrokenResourceError,
|
||||
BrokenPipeError,
|
||||
TransportClosed,
|
||||
) as _trans_err:
|
||||
|
|
|
|||
Loading…
Reference in New Issue