Add except path with exception debug to send_recv

The related bug resulted when an exception occurred within the
future.result() call. This caused the finally block to be executed,
and therefore myid to be deleted from self.outstanding_msgs prior
to _reader_main() checking if the msgid not in self.outstanding_msgs.
This caused _reader_main() to raise an AssertionError because the
msgid was no longer in outstanding_msgs. This is a small step forward
to log a warning when this siutation occurs.

Related-Bug: #1927868
Change-Id: I2eed242e0c796b8a2aa3d1b21bd1da4c497f624d
This commit is contained in:
Corey Bryant 2021-08-02 11:47:47 -04:00
parent f7f3349d6a
commit 4f1450677f
1 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import datetime
import enum
import logging
import socket
import sys
import threading
import msgpack
@ -186,6 +187,9 @@ class ClientChannel(object):
self.writer.send((myid, msg))
reply = future.result()
except Exception:
LOG.warning("Unexpected error: {}".format(sys.exc_info()[0]))
raise
finally:
del self.outstanding_msgs[myid]