aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libstore/build.cc5
-rw-r--r--src/libstore/pathlocks.cc8
-rw-r--r--src/libstore/pathlocks.hh1
3 files changed, 14 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index d44dcf0ff..5f1eb3415 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1023,6 +1023,8 @@ void DerivationGoal::tryToBuild()
} catch (BuildError & e) {
printMsg(lvlError, e.msg());
+ outputLocks.unlock();
+ buildUser.release();
if (printBuildTrace) {
if (usingBuildHook)
printMsg(lvlError, format("@ hook-failed %1% %2% %3% %4%")
@@ -1130,6 +1132,8 @@ void DerivationGoal::buildDone()
} catch (BuildError & e) {
printMsg(lvlError, e.msg());
+ outputLocks.unlock();
+ buildUser.release();
if (printBuildTrace) {
/* When using a build hook, the hook will return a
remote build failure using exit code 100. Anything
@@ -2068,6 +2072,7 @@ void DerivationGoal::computeClosure()
create new lock files with the same names as the old (unlinked)
lock files. */
outputLocks.setDeletion(true);
+ outputLocks.unlock();
}
diff --git a/src/libstore/pathlocks.cc b/src/libstore/pathlocks.cc
index df1f0b1e3..f8753bcb6 100644
--- a/src/libstore/pathlocks.cc
+++ b/src/libstore/pathlocks.cc
@@ -204,6 +204,12 @@ void PathLocks::lockPaths(const PathSet & _paths, const string & waitMsg)
PathLocks::~PathLocks()
{
+ unlock();
+}
+
+
+void PathLocks::unlock()
+{
for (list<FDPair>::iterator i = fds.begin(); i != fds.end(); i++) {
if (deletePaths) deleteLockFilePreClose(i->second, i->first);
@@ -216,6 +222,8 @@ PathLocks::~PathLocks()
debug(format("lock released on `%1%'") % i->second);
}
+
+ fds.clear();
}
diff --git a/src/libstore/pathlocks.hh b/src/libstore/pathlocks.hh
index 8b4100028..9898b497b 100644
--- a/src/libstore/pathlocks.hh
+++ b/src/libstore/pathlocks.hh
@@ -36,6 +36,7 @@ public:
void lockPaths(const PathSet & _paths,
const string & waitMsg = "");
~PathLocks();
+ void unlock();
void setDeletion(bool deletePaths);
};