From 2808227eb7cee190b1738f0448dc9a56f270ad1b Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Thu, 15 Apr 2021 14:50:04 +0200 Subject: [PATCH] Fix `std::bad_alloc` errors for remote builds In Nix the protocol was slightly altered[1] to also contain more information about realisations. This however wasn't read from the pipe that was used to read from the store. After the `cmdBuildDerivation` command which caused this issue, Hydra will issue a `cmdQueryPathInfos` that tries to read from the remote store as well. However, there's still left over to read from the previous command and thus Nix fails to properly allocate the expected string. [1] See rev a2b69660a9b326b95d48bd222993c5225bbd5b5f Fixes #898 --- src/hydra-queue-runner/build-remote.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hydra-queue-runner/build-remote.cc b/src/hydra-queue-runner/build-remote.cc index 966e27ca..17b9cdec 100644 --- a/src/hydra-queue-runner/build-remote.cc +++ b/src/hydra-queue-runner/build-remote.cc @@ -338,6 +338,9 @@ void State::buildRemote(ref destStore, result.stopTime = stop; } } + if (GET_PROTOCOL_MINOR(remoteVersion) >= 6) { + worker_proto::read(*localStore, from, Phantom {}); + } switch ((BuildResult::Status) res) { case BuildResult::Built: result.stepStatus = bsSuccess;