diff --git a/openpilot/sunnypilot/system/statsd.py b/openpilot/sunnypilot/system/statsd.py index 09309dd59c..8b5c426267 100755 --- a/openpilot/sunnypilot/system/statsd.py +++ b/openpilot/sunnypilot/system/statsd.py @@ -88,6 +88,12 @@ class StatLogSP(StatLog): self.comma_statlog.connect() def __del__(self): + # shares zmq.Context.instance() with comma_statlog; term() blocks while any socket on it is open + if self.comma_statlog and self.comma_statlog.sock is not None: + self.comma_statlog.sock.close() + self.comma_statlog.sock = None + if self.comma_statlog.zctx is self.zctx: + self.comma_statlog.zctx = None super().__del__() if self.comma_statlog: self.comma_statlog.__del__()