Skip to content

Commit

Permalink
Do not attempt to speak a newer version of the protocol
Browse files Browse the repository at this point in the history
Both sides need to agree on a version (with `std::min`) for anything to
work. Somehow... we've never done this.

With this comment, the next commit succeeds. Without this commit, the
next commit fails. This is because the next commit exposes serializers
which do different things for proto version 2.7, and we're currently
requesting 2.6.

Opened NixOS/nix#9584 to track this issue
  • Loading branch information
Ericson2314 committed Dec 10, 2023
1 parent 2bd6756 commit b56d238
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/hydra-queue-runner/build-remote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ static std::pair<Path, AutoCloseFD> openLogFile(const std::string & logDir, cons
*/
static void handshake(Machine::Connection & conn, unsigned int repeats)
{
conn.to << SERVE_MAGIC_1 << 0x206;
constexpr ServeProto::Version our_version = 0x206;

conn.to << SERVE_MAGIC_1 << our_version;
conn.to.flush();

unsigned int magic = readInt(conn.from);
Expand All @@ -215,6 +217,9 @@ static void handshake(Machine::Connection & conn, unsigned int repeats)
throw Error("unsupported ‘nix-store --serve’ protocol version on ‘%1%’", conn.machine->sshName);
if (GET_PROTOCOL_MINOR(conn.remoteVersion) < 3 && repeats > 0)
throw Error("machine ‘%1%’ does not support repeating a build; please upgrade it to Nix 1.12", conn.machine->sshName);

// Do not attempt to speak a newer version of the protocol
conn.remoteVersion = std::min(conn.remoteVersion, our_version);
}

static BasicDerivation sendInputs(
Expand Down

0 comments on commit b56d238

Please sign in to comment.