summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-05-15 02:30:15 -0700
committerZac Medico <zmedico@gentoo.org>2011-05-15 02:30:15 -0700
commit405ad9eed65393205ec28af8772f7ea45ce0371e (patch)
treefc6e02ffff76a7f13fb706da6d3869771c99ecbe
parent33a3a2d9cdc44e07aaece8fdf08a3d3bde6e5d82 (diff)
downloadportage-405ad9eed65393205ec28af8772f7ea45ce0371e.tar.gz
portage-405ad9eed65393205ec28af8772f7ea45ce0371e.tar.bz2
portage-405ad9eed65393205ec28af8772f7ea45ce0371e.zip
counter_tick_core: don't lock if parallel-install
This is the same as commit 461564ae94ff936918eeaa18493bc1da3846796f but this time with comments that make sense.
-rw-r--r--pym/portage/dbapi/vartree.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 40f0cfb0f..d602a37c0 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -815,7 +815,18 @@ class vardbapi(dbapi):
"""
myroot = None
mycpv = None
- self.lock()
+ locked_vdb = False
+ if "parallel-install" not in self.settings.features:
+ # If parallel-install is enabled, it's unsafe to
+ # lock the vdb here because it can deadlock the
+ # Scheduler by preventing it from servicing its
+ # poll loop which is essential for at least a
+ # couple of reasons:
+ # 1) releasing locks held by the scheduler
+ # 2) handling output of subprocesses so that they
+ # don't deadlock due to blocking on stdout
+ self.lock()
+ locked_vdb = True
try:
counter = self.get_counter_tick_core() - 1
if self._cached_counter != counter:
@@ -829,7 +840,8 @@ class vardbapi(dbapi):
write_atomic(self._counter_path, str(counter))
self._cached_counter = counter
finally:
- self.unlock()
+ if locked_vdb:
+ self.unlock()
return counter