forked from goodboy/tractor
1
0
Fork 0

Ignore drainer-task nursery RTE during context exit

ctx_cancel_semantics_and_overruns
Tyler Goodlet 2023-04-13 23:45:08 -04:00
parent 968f13f9ef
commit 04e4397a8f
1 changed files with 16 additions and 9 deletions

View File

@ -539,7 +539,6 @@ class Context:
# from ._debug import breakpoint # from ._debug import breakpoint
# await breakpoint() # await breakpoint()
# XXX: this will break early callee results sending # XXX: this will break early callee results sending
# since when `.result()` is finally called, this # since when `.result()` is finally called, this
# chan will be closed.. # chan will be closed..
@ -966,8 +965,12 @@ class Context:
local_uid = current_actor().uid local_uid = current_actor().uid
lines = [ lines = [
f'Actor-task context {cid}@{local_uid} was overrun by remote!', f'OVERRUN on actor-task context {cid}@{local_uid}!\n'
f'sender actor: {uid}', # TODO: put remote task name here if possible?
f'remote sender actor: {uid}',
# TODO: put task func name here and maybe an arrow
# from sender to overrunner?
# f'local task {self.func_name}'
] ]
if not self._stream_opened: if not self._stream_opened:
lines.insert( lines.insert(
@ -988,13 +991,17 @@ class Context:
): ):
self._overflow_q.append(msg) self._overflow_q.append(msg)
n = self._scope_nursery n = self._scope_nursery
if n.child_tasks:
from . import _debug
await _debug.breakpoint()
assert not n.child_tasks assert not n.child_tasks
try:
n.start_soon( n.start_soon(
self._drain_overflows, self._drain_overflows,
) )
except RuntimeError:
# if the nursery is already cancelled due to
# this context exiting or in error, we ignore
# the nursery error since we never expected
# anything different.
return False
else: else:
try: try:
raise StreamOverrun(text) raise StreamOverrun(text)