From cb1c1004cdd582abe67146ab3904bd88de3a1d4e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 28 Aug 2007 16:22:08 +0000 Subject: [PATCH] * When there are multiple substituters, make sure to release the lock on the output path after trying each. Otherwise the pathIsLockedByMe() test gets confused. --- src/libstore/build.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 5ad810500..85933e84f 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -1310,6 +1310,10 @@ DerivationGoal::PrepareBuildReply DerivationGoal::prepareBuild() /* Obtain locks on all output paths. The locks are automatically released when we exit this function or Nix crashes. */ /* !!! BUG: this could block, which is not allowed. */ + /* !!! and once we make this non-blocking, we should carefully + consider the case where some but not all locks are required; we + should then release the acquired locks so that the other + processes and the pathIsLockedByMe() test don't get confused. */ outputLocks.lockPaths(outputPaths(drv.outputs), (format("waiting for lock on %1%") % showPaths(outputPaths(drv.outputs))).str()); @@ -2080,6 +2084,7 @@ void SubstitutionGoal::tryToRun() /* Maybe a derivation goal has already locked this path (exceedingly unlikely, since it should have used a substitute first, but let's be defensive). */ + outputLock.reset(); // make sure this goal's lock is gone if (pathIsLockedByMe(storePath)) { debug(format("restarting substitution of `%1%' because it's locked by another goal") % storePath);