From 4092db60b26095cbd3312bdb1eb0c2a3005e6620 Mon Sep 17 00:00:00 2001 From: goodboy Date: Fri, 13 Mar 2026 12:08:36 -0400 Subject: [PATCH] Revert advanced-fault UDS edge case handling Namely the workaround expected exc branches added in ef7ed7a for the UDS parametrization. With the new boxing of the underlying CREs as tpt-closed, we can expect the same exc outcomes as in the TCP cases. Also this tweaks some error report logging content used while debugging this, - properly `repr()` the `TransportClosed.src_exc`-type from the maybe emit in `.report_n_maybe_raise()`. - remove the redudant `chan.raddr` from the "closed abruptly" header in the tpt-closed handler of `._rpc.process_messages()`, the `Channel.__repr__()` now contains it by default. --- tests/test_advanced_faults.py | 7 ------- tractor/_exceptions.py | 3 ++- tractor/_rpc.py | 4 +--- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/tests/test_advanced_faults.py b/tests/test_advanced_faults.py index 2103f627..009e25b0 100644 --- a/tests/test_advanced_faults.py +++ b/tests/test_advanced_faults.py @@ -146,9 +146,6 @@ def test_ipc_channel_break_during_stream( # a user sending ctl-c by raising a KBI. if pre_aclose_msgstream: expect_final_exc = KeyboardInterrupt - if tpt_proto == 'uds': - expect_final_exc = TransportClosed - expect_final_cause = trio.BrokenResourceError # XXX OLD XXX # if child calls `MsgStream.aclose()` then expect EoC. @@ -169,10 +166,6 @@ def test_ipc_channel_break_during_stream( if pre_aclose_msgstream: expect_final_exc = KeyboardInterrupt - if tpt_proto == 'uds': - expect_final_exc = TransportClosed - expect_final_cause = trio.BrokenResourceError - # NOTE when the parent IPC side dies (even if the child does as well # but the child fails BEFORE the parent) we always expect the # IPC layer to raise a closed-resource, NEVER do we expect diff --git a/tractor/_exceptions.py b/tractor/_exceptions.py index 418accc3..15b785fa 100644 --- a/tractor/_exceptions.py +++ b/tractor/_exceptions.py @@ -982,6 +982,7 @@ class TransportClosed(Exception): ''' __tracebackhide__: bool = hide_tb message: str = message or self.message + # when a cause is set, slap it onto the log emission. if cause := self.src_exc: cause_tb_str: str = ''.join( @@ -989,7 +990,7 @@ class TransportClosed(Exception): ) message += ( f'{cause_tb_str}\n' # tb - f' {cause}\n' # exc repr + f'{cause!r}\n' # exc repr ) getattr( diff --git a/tractor/_rpc.py b/tractor/_rpc.py index cae92bad..9bd1c475 100644 --- a/tractor/_rpc.py +++ b/tractor/_rpc.py @@ -1313,12 +1313,10 @@ async def process_messages( f'peer IPC channel closed abruptly?\n' f'\n' f'<=x[\n' - f' {chan}\n' - f' |_{chan.raddr}\n\n' + f'{chan}\n' ) + tc.message - ) # transport **WAS** disconnected