From 5168700fbfd73172be940eb80a53fc9e0ab991ad Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 1 Jul 2022 14:37:46 -0400 Subject: [PATCH] Tolerate non-decode-able bytes --- tractor/_ipc.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tractor/_ipc.py b/tractor/_ipc.py index 2f51004..6679366 100644 --- a/tractor/_ipc.py +++ b/tractor/_ipc.py @@ -185,11 +185,15 @@ class MsgpackTCPStream(MsgTransport): # ignore decoding errors for now and assume they have to # do with a channel drop - hope that receiving from the # channel will raise an expected error and bubble up. - decoded_bytes = msg_bytes.decode() + try: + data = msg_bytes.decode() + except UnicodeDecodeError: + data = msg_bytes + log.error( '`msgspec` failed to decode!?\n' 'dumping bytes:\n' - f'{decoded_bytes}' + f'{data}' ) decodes_failed += 1 else: