From 50ab80caf2e1e56a5f5ce8f3d5d4585b4dbe1dde Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 1 Sep 2017 15:29:06 +0200 Subject: [PATCH] Don't wait forever to acquire the send lock --- src/hydra-queue-runner/build-remote.cc | 3 ++- src/hydra-queue-runner/state.hh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hydra-queue-runner/build-remote.cc b/src/hydra-queue-runner/build-remote.cc index fd728205..298d886e 100644 --- a/src/hydra-queue-runner/build-remote.cc +++ b/src/hydra-queue-runner/build-remote.cc @@ -229,7 +229,8 @@ void State::buildRemote(ref destStore, /* Copy the input closure. */ if (/* machine->sshName != "localhost" */ true) { auto mc1 = std::make_shared(nrStepsWaiting); - std::lock_guard sendLock(machine->state->sendLock); + std::unique_lock sendLock( + machine->state->sendLock, std::chrono::seconds(600)); mc1.reset(); MaintainCount mc2(nrStepsCopyingTo); printMsg(lvlDebug, format("sending closure of ‘%1%’ to ‘%2%’") % step->drvPath % machine->sshName); diff --git a/src/hydra-queue-runner/state.hh b/src/hydra-queue-runner/state.hh index b9d98cd3..93c06a73 100644 --- a/src/hydra-queue-runner/state.hh +++ b/src/hydra-queue-runner/state.hh @@ -231,7 +231,7 @@ struct Machine /* Mutex to prevent multiple threads from sending data to the same machine (which would be inefficient). */ - std::mutex sendLock; + std::timed_mutex sendLock; }; State::ptr state;