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

Process wide locks are not removed in case of errors #3725

Closed
fgrehm opened this issue May 8, 2014 · 8 comments
Closed

Process wide locks are not removed in case of errors #3725

fgrehm opened this issue May 8, 2014 · 8 comments

Comments

@fgrehm
Copy link
Contributor

fgrehm commented May 8, 2014

$ vagrant -v
Vagrant 1.6.1

$ cat Vagrantfile 
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox'
Vagrant.configure("2") do |config|
  config.vm.box = 'ffuenf/ubuntu-13.10-server-amd64'
  config.vm.provision :shell, inline: 'ERROR!!!!!'
end

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ffuenf/ubuntu-13.10-server-amd64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ffuenf/ubuntu-13.10-server-amd64' is up to date...
==> default: A newer version of the box 'ffuenf/ubuntu-13.10-server-amd64' is available! You currently
==> default: have version '0.0.22'. The latest is version '0.0.24'. Run
==> default: `vagrant box update` to update.
==> default: Setting the name of the VM: playground_default_1399582777790_84959
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 => 2200 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2200
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => /home/fabio/projects/playground
    default: /tmp/vagrant-cache => /home/fabio/.vagrant.d/cache/ffuenf/ubuntu-13.10-server-amd64
    default: /tmp/vagrant-notify => /tmp/vagrant-notify/4ad0d92f-424c-4aea-8764-75e021b2bd53
==> default: Configuring cache buckets...
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: stdin: is not a tty
==> default: /tmp/vagrant-shell: line 1: ERROR!!!!!: command not found
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell

Stdout from the command:



Stderr from the command:

stdin: is not a tty
/tmp/vagrant-shell: line 1: ERROR!!!!!: command not found

$ vagrant provision
An action 'provision' was attempted on the machine 'default',
but another process is already executing an action on the machine.
Vagrant locks each machine for access by only one process at a time.
Please wait until the other Vagrant process finishes modifying this
machine, then try again.

If you believe this message is in error, please check the process
listing for any "ruby" or "vagrant" processes and kill them. Then
try again.

# Remove locks
$ rm -rf ~/.vagrant.d/data/lock.*

# This breaks again, but the provisioner kicks in because there is no lock
$ vagrant provision
==> default: Configuring cache buckets...
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: stdin: is not a tty
==> default: /tmp/vagrant-shell: line 1: ERROR!!!!!: command not found
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell

Stdout from the command:



Stderr from the command:

stdin: is not a tty
/tmp/vagrant-shell: line 1: ERROR!!!!!: command not found

@mitchellh kinda unrelated to this but should we have a vagrant clear-locks command around?

@mitchellh
Copy link
Contributor

The locks are tied to the process... using flock. Once the process dies, the lock is unlocked. I actually tested this myself and it seemed to work. So that is super weird. Uhhh.

@mitchellh
Copy link
Contributor

Just tested again and totally worked. o.O

@fgrehm
Copy link
Contributor Author

fgrehm commented May 8, 2014

I'm on Ubuntu 14.04, maybe we got into a ruby issue?

@mitchellh
Copy link
Contributor

@mitchellh
Copy link
Contributor

There is probably a way we can implement this locking without flock. I'll look into it. Tagged as enhancement.

@fgrehm
Copy link
Contributor Author

fgrehm commented May 8, 2014

😲 WOW, that was a tricky one, thanks for the pointer, the problem actually relies on vagrant-notify as it forks a process with the HTTP server that gets the notify-send requests from the guest machine.

Uninstalling it fixes the issue, so I think flock is cool 😎

@mitchellh
Copy link
Contributor

Ah. hah. In that case I think flocks are fine for now since it works and is easy. There is some refactoring I plan on doing around it though.

@kenorb
Copy link
Contributor

kenorb commented Jun 27, 2016

The vagrant global-status --prune command worked for me to remove invalid entries.

@ghost ghost locked and limited conversation to collaborators Apr 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants