From 4f1450677ff7c6b22496c391ab87dc79c86c3ef4 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 2 Aug 2021 11:47:47 -0400 Subject: [PATCH] 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 --- oslo_privsep/comm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/oslo_privsep/comm.py b/oslo_privsep/comm.py index fb1872f..c609a87 100644 --- a/oslo_privsep/comm.py +++ b/oslo_privsep/comm.py @@ -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]