Skip to content

Use LegacySSHStore#1444

Merged
Ericson2314 merged 1 commit intomasterfrom
use-legacy-ssh-store
Feb 18, 2025
Merged

Use LegacySSHStore#1444
Ericson2314 merged 1 commit intomasterfrom
use-legacy-ssh-store

Conversation

@Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Feb 14, 2025

In NixOS/nix#10748 it is extended with everything we need.


We are no longer explicit about reusing the same connection. However:

  1. Nix's pool mechanism will not close valid connections; it always keeps them around in case they are of use later

  2. Max connections defaults to 1, so we won't open up multiple connections.

Between these two things, we are, in fact, guaranteed to reuse the same connection from one command/query to the next.

@Ericson2314 Ericson2314 changed the base branch from master to nix-next February 14, 2025 02:40
@Ericson2314 Ericson2314 force-pushed the use-legacy-ssh-store branch 2 times, most recently from 5228c32 to 4c173da Compare February 14, 2025 23:50
@Ericson2314 Ericson2314 marked this pull request as ready for review February 17, 2025 00:04
@Ericson2314 Ericson2314 changed the base branch from nix-next to master February 17, 2025 00:10
Comment on lines -61 to -68
// XXX: determine the actual max value we can use from /proc.

// FIXME: Should this be upstreamed into `startCommand` in Nix?

int pipesize = 1024 * 1024;

fcntl(ret->in.get(), F_SETPIPE_SZ, &pipesize);
fcntl(ret->out.get(), F_SETPIPE_SZ, &pipesize);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In NixOS/nix#10765 @vcunat determind this code was wrong. However, if the address is not too large it might make the pipe larger? Something should be done upstream.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now done below too.

See

remoteStore->connPipeSize = 1024 * 1024;

Setting a variable doesn't have any side-effects. We do that before any connection is established, however, and then that setting will be applied.

}

auto ret = master.startCommand(std::move(command), {
"-a", "-oBatchMode=yes", "-oConnectTimeout=60", "-oTCPKeepAlive=yes"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are moved below

Comment on lines -46 to -48
if (machine->isLocalhost()) {
command.push_back("--builders");
command.push_back("");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done below

Comment on lines -50 to -54
auto remoteStore = machine->storeUri.params.find("remote-store");
if (remoteStore != machine->storeUri.params.end()) {
command.push_back("--store");
command.push_back(shellEscape(remoteStore->second));
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is handled by Nix.

In NixOS/nix#10748 it is extended with
everything we need.
@Ericson2314 Ericson2314 merged commit 18c0d76 into master Feb 18, 2025
2 checks passed
@Ericson2314 Ericson2314 deleted the use-legacy-ssh-store branch February 18, 2025 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant