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:
await chan.send(err_msg)
except trio.ClosedResourceError:
log.exception(
log.warning(
f"Failed to ship error to caller @ {chan.uid}")
if cs is None:
# error is from above code not from rpc invocation

View File

@ -15,6 +15,7 @@ from .log import get_logger
from . import _state
from ._discovery import get_root
from ._state import is_root_process
from ._exceptions import is_multi_cancelled
try:
# 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
# might be a simpler check we can do?
and trio.MultiError.filter(
lambda exc: exc if not isinstance(exc, trio.Cancelled) else None,
err,
)
and not is_multi_cancelled(err)
):
log.warning("Actor crashed, entering debug mode")
await post_mortem()

View File

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

View File

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