Absorb `TransportClosed` in `Portal.cancel_actor()`
Just like we *were* for the `trio`-resource-errors it normally wraps since we now also do the same wrapping in `MsgpackTransport.send()` and we don't normally care to raise tpt-closure-errors on graceful actor cancel requests. Also, warn-report any non-tpt-closed low-level `trio` errors we haven't yet re-wrapped (likely bc they haven't shown up).structural_dynamics_of_flow
							parent
							
								
									477343af53
								
							
						
					
					
						commit
						5f74ce9a95
					
				|  | @ -52,8 +52,8 @@ from .msg import ( | ||||||
|     Return, |     Return, | ||||||
| ) | ) | ||||||
| from ._exceptions import ( | from ._exceptions import ( | ||||||
|     # unpack_error, |  | ||||||
|     NoResult, |     NoResult, | ||||||
|  |     TransportClosed, | ||||||
| ) | ) | ||||||
| from ._context import ( | from ._context import ( | ||||||
|     Context, |     Context, | ||||||
|  | @ -305,14 +305,34 @@ class Portal: | ||||||
|             return False |             return False | ||||||
| 
 | 
 | ||||||
|         except ( |         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.ClosedResourceError, | ||||||
|             trio.BrokenResourceError, |             trio.BrokenResourceError, | ||||||
|         ): | 
 | ||||||
|             log.debug( |             TransportClosed, | ||||||
|                 'IPC chan for actor already closed or broken?\n\n' |         ) as tpt_err: | ||||||
|  |             report: str = ( | ||||||
|  |                 f'IPC chan for actor already closed or broken?\n\n' | ||||||
|                 f'{self.channel.aid}\n' |                 f'{self.channel.aid}\n' | ||||||
|                 f' |_{self.channel}\n' |                 f' |_{self.channel}\n' | ||||||
|             ) |             ) | ||||||
|  |             match tpt_err: | ||||||
|  |                 case TransportClosed(): | ||||||
|  |                     log.debug(report) | ||||||
|  |                 case _: | ||||||
|  |                     report += ( | ||||||
|  |                         f'\n' | ||||||
|  |                         f'Unhandled low-level transport-closed/error during\n' | ||||||
|  |                         f'Portal.cancel_actor()` request?\n' | ||||||
|  |                         f'<{type(tpt_err).__name__}( {tpt_err} )>\n' | ||||||
|  |                     ) | ||||||
|  |                     log.warning(report) | ||||||
|  | 
 | ||||||
|             return False |             return False | ||||||
| 
 | 
 | ||||||
|     # TODO: do we still need this for low level `Actor`-runtime |     # TODO: do we still need this for low level `Actor`-runtime | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue