diff --git a/parsl/curvezmq.py b/parsl/curvezmq.py index cd220c818f..3e0ad9409f 100644 --- a/parsl/curvezmq.py +++ b/parsl/curvezmq.py @@ -49,9 +49,6 @@ def __init__(self, cert_dir: Optional[Union[str, os.PathLike]]) -> None: self.cert_dir = cert_dir self._ctx = zmq.Context() - def __del__(self): - self.destroy() - @property def encrypted(self): """Indicates whether encryption is enabled. @@ -136,6 +133,12 @@ def __init__(self, cert_dir: Optional[Union[str, os.PathLike]]) -> None: if self.encrypted: self.auth_thread = self._start_auth_thread() + def __del__(self): + # Avoid issues in which the auth_thread attr was + # previously deleted + if getattr(self, "auth_thread", None): + self.auth_thread.stop() + def _start_auth_thread(self) -> ThreadAuthenticator: auth_thread = ThreadAuthenticator(self._ctx) auth_thread.start()