Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy_nixos/nixos-deploy.sh: fix ControlPersist timeout #29

Merged
merged 2 commits into from Apr 20, 2020

Conversation

betaboon
Copy link
Contributor

fixes #20 by gracefully closing the multiplexing master process gracefully.

https://man.openbsd.org/ssh
Control an active connection multiplexing master process. When the -O option is specified, the ctl_cmd argument is interpreted and passed to the master process. Valid commands are: “check” (check that the master process is running), “forward” (request forwardings without command execution), “cancel” (cancel forwardings), “exit” (request the master to exit), and “stop” (request the master to stop accepting further multiplexing requests).

@zimbatm
Copy link
Member

zimbatm commented Apr 17, 2020

@betaboon: what problem does it solve? Persisted connections should automatically timeout and be discarded in the background.

@betaboon
Copy link
Contributor Author

@zimbatm as mentioned in #20 the persisted connection only times out N-seconds after it has been active last. thus it takes N second for the deployment to finish even after it is actually done.

@zimbatm
Copy link
Member

zimbatm commented Apr 18, 2020

What I don't understand is why this is blocking the script in the first place. My understanding is that the TCP connection is maintained in the background somehow and shouldn't prevent the script from exiting.

@betaboon
Copy link
Contributor Author

i wonder if this is related:
hashicorp/terraform#12139
hashicorp/terraform#22037

@zimbatm zimbatm force-pushed the fix-20-control-persist-timeout branch from 926ac64 to b57ab87 Compare April 20, 2020 06:59
@zimbatm
Copy link
Member

zimbatm commented Apr 20, 2020

@betaboon I pushed another version that also cleans-up on unhappy paths. Since the ControlPath is now specific to this script I also moved it to be a temp file to avoid clashes with other potentially-running scripts.

@betaboon
Copy link
Contributor Author

@zimbatm nice improvements. just checked them out and tested them with my setup. seems to work as expected :)

@zimbatm
Copy link
Member

zimbatm commented Apr 20, 2020

thanks!

@zimbatm zimbatm merged commit 9796da3 into nix-community:master Apr 20, 2020
@betaboon betaboon deleted the fix-20-control-persist-timeout branch April 20, 2020 07:37
@betaboon
Copy link
Contributor Author

thank you very much

@Profpatsch
Copy link

Thanks, I just tried it out in our deployment and it works.

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.

deploy_nixos: ssh ControlPersist keeps connection open until timeout
3 participants