From cc0f1e29f792e35a888b9ae9caf1008bbcd270c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 25 Jan 2023 17:52:44 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20swu:=20protect=20against=20poten?= =?UTF-8?q?tial=20deadlock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If for some reason an exception gets thrown inside get_current_versions that doesn't get caught therein, `_get_versions_data_ready` will never be set and thus any calls waiting for it will block forever. This patch fixes that by always setting the event in the `finally` block. --- src/octoprint/plugins/softwareupdate/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index ea95f21da..41fd4bb0f 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -1766,9 +1766,9 @@ class SoftwareUpdatePlugin( self._save_version_cache() self._get_versions_data = information, update_available, update_possible - self._get_versions_data_ready.set() finally: self._get_versions_mutex.release() + self._get_versions_data_ready.set() else: # something's already in progress, let's wait for it to complete and use its result self._get_versions_data_ready.wait()