From b0c85ffcce6bca6458d3454710156881f6ee42b2 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Thu, 5 Dec 2013 07:56:22 +0100 Subject: [PATCH] [solo.commands.search] do not hold the inst_repo lock while using stdio functions print_package_info is already able to deal with stale data and we better not deadlock other threads or processes there. --- client/solo/commands/search.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/client/solo/commands/search.py b/client/solo/commands/search.py index 2a5d29d4e..8f5863984 100644 --- a/client/solo/commands/search.py +++ b/client/solo/commands/search.py @@ -196,18 +196,20 @@ Search for packages. entropy_client, string) inst_repo = entropy_client.installed_repository() - with inst_repo.shared(): - for pkg_id, pkg_repo in results: + for pkg_id, pkg_repo in results: - dbconn = entropy_client.open_repository(pkg_repo) - if not dbconn.isPackageIdAvailable(pkg_id): - continue + repo = entropy_client.open_repository(pkg_repo) + if not repo.isPackageIdAvailable(pkg_id): + continue - print_package_info( - pkg_id, entropy_client, dbconn, - extended = self._verbose, - installed_search = dbconn is inst_repo, - quiet = self._quiet) + # this method is fault tolerant and we better not + # hold the installed repository lock during print + # because we can deadlock other processes/threads. + print_package_info( + pkg_id, entropy_client, repo, + extended = self._verbose, + installed_search = repo is inst_repo, + quiet = self._quiet) return results