Denoise some common teardown "errors" to warnings.

denoise_logging
Tyler Goodlet 2020-12-25 15:10:20 -05:00
parent 8522f90000
commit 5d7a4e2b12
4 changed files with 8 additions and 7 deletions

View File

@ -144,7 +144,7 @@ async def _invoke(
try: try:
await chan.send(err_msg) await chan.send(err_msg)
except trio.ClosedResourceError: except trio.ClosedResourceError:
log.exception( log.warning(
f"Failed to ship error to caller @ {chan.uid}") f"Failed to ship error to caller @ {chan.uid}")
if cs is None: if cs is None:
# error is from above code not from rpc invocation # error is from above code not from rpc invocation

View File

@ -15,6 +15,7 @@ from .log import get_logger
from . import _state from . import _state
from ._discovery import get_root from ._discovery import get_root
from ._state import is_root_process from ._state import is_root_process
from ._exceptions import is_multi_cancelled
try: try:
# wtf: only exported when installed in dev mode? # wtf: only exported when installed in dev mode?
@ -318,10 +319,7 @@ async def _maybe_enter_pm(err):
# Really we just want to mostly avoid catching KBIs here so there # Really we just want to mostly avoid catching KBIs here so there
# might be a simpler check we can do? # might be a simpler check we can do?
and trio.MultiError.filter( and not is_multi_cancelled(err)
lambda exc: exc if not isinstance(exc, trio.Cancelled) else None,
err,
)
): ):
log.warning("Actor crashed, entering debug mode") log.warning("Actor crashed, entering debug mode")
await post_mortem() await post_mortem()

View File

@ -51,7 +51,7 @@ class MsgpackStream:
data = await self.stream.receive_some(2**10) data = await self.stream.receive_some(2**10)
log.trace(f"received {data}") # type: ignore log.trace(f"received {data}") # type: ignore
except trio.BrokenResourceError: except trio.BrokenResourceError:
log.error(f"Stream connection {self.raddr} broke") log.warning(f"Stream connection {self.raddr} broke")
return return
if data == b'': if data == b'':

View File

@ -13,6 +13,7 @@ from ._state import current_actor
from .log import get_logger, get_loglevel from .log import get_logger, get_loglevel
from ._actor import Actor from ._actor import Actor
from ._portal import Portal from ._portal import Portal
from ._exceptions import is_multi_cancelled
from . import _state from . import _state
from . import _spawn from . import _spawn
@ -246,7 +247,9 @@ async def open_nursery() -> typing.AsyncGenerator[ActorNursery, None]:
# For now, shield both. # For now, shield both.
with trio.CancelScope(shield=True): with trio.CancelScope(shield=True):
etype = type(err) etype = type(err)
if etype in (trio.Cancelled, KeyboardInterrupt): if etype in (trio.Cancelled, KeyboardInterrupt) or (
is_multi_cancelled(err)
):
log.warning( log.warning(
f"Nursery for {current_actor().uid} was " f"Nursery for {current_actor().uid} was "
f"cancelled with {etype}") f"cancelled with {etype}")