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

containers: Deploying after destroying makes nixops hang #809

Open
nh2 opened this issue Dec 10, 2017 · 2 comments
Open

containers: Deploying after destroying makes nixops hang #809

nh2 opened this issue Dec 10, 2017 · 2 comments

Comments

@nh2
Copy link
Contributor

nh2 commented Dec 10, 2017

When I use targetEnv = "container";, and nixops destroy, and then immediately nixops deploy again, nixops hangs at this output:

...
machine1.> creating container...
machine3..> creating container...
machine1.> host IP is 10.233.130.1, container IP is 10.233.130.2
machine3..> host IP is 10.233.131.1, container IP is 10.233.131.2
machine2> IP address is 10.233.122.2
machine2> setting state version to 17.09
^C
Traceback (most recent call last):
  File "./ops", line 130, in <module>
    env=env,
  File "/nix/store/k0c5spdm7g4lb9gkm3l20v81dbl93s0h-python3-3.6.3/lib/python3.6/subprocess.py", line 269, in call
    return p.wait(timeout=timeout)
  File "/nix/store/k0c5spdm7g4lb9gkm3l20v81dbl93s0h-python3-3.6.3/lib/python3.6/subprocess.py", line 1457, in wait
    (pid, sts) = self._try_wait(0)
  File "/nix/store/k0c5spdm7g4lb9gkm3l20v81dbl93s0h-python3-3.6.3/lib/python3.6/subprocess.py", line 1404, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)
KeyboardInterrupt

The ^C is where I killed it with Ctrl+C because it hung forever.

The reason for this is that nixos-container destroy, which nixops calls, is asynchronous and exits immediately; thus for the next deploy (and if the container didn't shut down immediately), nixops and nixos-container think they can re-use existing container names that are actually still in use (they show up in machinectl).

See NixOS/nixpkgs#32545

@nh2
Copy link
Contributor Author

nh2 commented Dec 10, 2017

PR in #810

@nh2
Copy link
Contributor Author

nh2 commented Dec 10, 2017

Also related: NixOS/nixpkgs#32551 that makes container shutdowns take the full 90 seconds, thus making this issue here very visible.

nh2 added a commit to nh2/nixpkgs that referenced this issue Dec 29, 2017
…xOS#32545.

This also fixes the race condition found in NixOS#32551.

And it fixes nixops's repeated destroy/deploy being broken
(NixOS/nixops#809).
fpletz pushed a commit to NixOS/nixpkgs that referenced this issue Mar 12, 2018
…2545.

This also fixes the race condition found in #32551.

And it fixes nixops's repeated destroy/deploy being broken
(NixOS/nixops#809).

(cherry picked from commit 5d83988)
nh2 added a commit to nh2/nixops that referenced this issue Apr 17, 2018
nh2 added a commit to nh2/nixops that referenced this issue Oct 28, 2018
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

No branches or pull requests

1 participant