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
This commit is contained in:
Maximilian Bosch 2021-04-15 14:50:04 +02:00
parent ffc4be6743
commit 2808227eb7
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E

View file

@ -338,6 +338,9 @@ void State::buildRemote(ref<Store> destStore,
result.stopTime = stop;
}
}
if (GET_PROTOCOL_MINOR(remoteVersion) >= 6) {
worker_proto::read(*localStore, from, Phantom<DrvOutputs> {});
}
switch ((BuildResult::Status) res) {
case BuildResult::Built:
result.stepStatus = bsSuccess;