winnfsd / vagrant-winnfsd

Manage and adds support for NFS for Vagrant on Windows.
Other
567 stars 62 forks source link

Intermittent problem on plugin init #25

Open epipho opened 9 years ago

epipho commented 9 years ago

About 50% of the time after installing the plugin all vagrant commands bail out with the following error and stack:

C:/Users/fish/.vagrant.d/gems/gems/vagrant-winnfsd-1.0.10/lib/vagrant-winnfsd/plugin.rb:60:in `system': no implicit conversion from nil to integer (TypeError)
        from C:/Users/fish/.vagrant.d/gems/gems/vagrant-winnfsd-1.0.10/lib/vagrant-winnfsd/plugin.rb:60:in `init_plugin'
        from C:/Users/fish/.vagrant.d/gems/gems/vagrant-winnfsd-1.0.10/lib/vagrant-winnfsd/plugin.rb:20:in `block in <class:Plugin>'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:42:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:42:in `block (2 levels) in run'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:41:in `tap'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:41:in `block in run'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:40:in `map'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:40:in `run'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:386:in `hook'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:178:in `initialize'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/bin/vagrant:165:in `new'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.5/bin/vagrant:165:in `<main>'

I added some logging in the area and verified that the string being passed to system is ok. Vagrant version is 1.6.5.

tseho commented 9 years ago

I have the same bug really often, happening with vagrant 1.6.3/1.6.4/1.6.5 on Windows 7. I also tried vagrant-winnfsd 1.0.9, same issue.

lukebennett commented 9 years ago

We've just started getting this - began occurring randomly with nothing seemingly having changed.

v1.0.11 Vagrant 1.7.1 Windows 7

tseho commented 9 years ago

I gave up, Vagrant + Windows was really annoying.

worthwhileindustries commented 9 years ago

+1

mmodler commented 9 years ago

+1

GM-Alex commented 9 years ago

Could it be that you run the vagrant up command some times from different command lines, for example cmd, cmd as administrator, git bash?

mmodler commented 9 years ago

Got the error message yesterday on my laptop: windows 7, git bash, Vagrant 1.7.2 today on my office desktop: windows 7, git bash, Vagrant 1.6.5

GM-Alex commented 9 years ago

Could you try to run netsh advfirewall firewall show rule name="VagrantWinNFSd-1.0.11">nul at git bash and post the output here?

worthwhileindustries commented 9 years ago

I have this too. However, I have found on windows that having Chrome open causes issues like this and this is not the only plugin that bombs out like this. Not sure if it's a plugin issue or vagrant. Packer never seems to have issues like this. If you are using Chrome just close it out when upping or halting machines. It's not a fix but, it definitely has eliminated a lot of my problems. There's another issue where machines go into a bad state after being upped even when Chrome is closed. This I have found to be a process running in Task Manager after killing a bunch of them at random. Trying to figure out which one it is.

GM-Alex commented 9 years ago

WTF?!? Can someone else confirm that?

worthwhileindustries commented 9 years ago

@GM-Alex I assume you mean my statement above. I would love someone else to confirm as well. My coworker has. The second item about going into a bad state I'm still trying to pinpoint. Super annoying. The Chrome issue is definitely a thing. I do keep 10 or so tabs pinned. Haven't verified if it's a particular app tab or not.

worthwhileindustries commented 9 years ago

Windows 8.1 | Vagrant 1.7.2 | vagrant-winnfsd-1.0.11 Here's an example: I have 4 vm's running in a private network and go to halt one of them. It throws error. This particular vm that I am halting doesn't even have NFS as any of it's shared folders however, 1 of the 4 does. Try it again and it works. All of this is after closing Chrome but, right after which can usually happen if I try halting something immediately after closing Chrome and don't give it enough time to kill whatever processes it's tied to. Anyway, not sure how much any of this helps but, my two cents.

C:\_worthwhile\vm\appsuite_reporting>vagrant halt sa_jasper
C:/Users/Tristan/.vagrant.d/gems/gems/vagrant-winnfsd-1.0.11/lib/vagrant-winnfsd/plugin.rb:60:in `system': no implicit conversion from nil to integer (TypeError)
        from C:/Users/Tristan/.vagrant.d/gems/gems/vagrant-winnfsd-1.0.11/lib/vagrant-winnfsd/plugin.rb:60:in `init_plugin'
        from C:/Users/Tristan/.vagrant.d/gems/gems/vagrant-winnfsd-1.0.11/lib/vagrant-winnfsd/plugin.rb:20:in `block in <class:Plugin>'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:42:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:42:in `block (2 levels) in run'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:41:in `tap'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:41:in `block in run'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:40:in `map'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:40:in `run'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:428:in `hook'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:187:in `initialize'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/bin/vagrant:165:in `new'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/bin/vagrant:165:in `<main>'

C:\_worthwhile\vm\appsuite_reporting>vagrant halt sa_jasper
==> sa_jasper: Attempting graceful shutdown of VM...

C:\_worthwhile\vm\appsuite_reporting>vagrant up sa_jasper
Bringing machine 'sa_jasper' up with 'virtualbox' provider...
==> sa_jasper: Checking if box 'appsuite/sa_jasper' is up to date...
==> sa_jasper: Clearing any previously set forwarded ports...
==> sa_jasper: Fixed port collision for 22 => 2222. Now on port 2201.
==> sa_jasper: Clearing any previously set network interfaces...
==> sa_jasper: Preparing network interfaces based on configuration...
    sa_jasper: Adapter 1: nat
    sa_jasper: Adapter 2: hostonly
==> sa_jasper: Forwarding ports...
    sa_jasper: 22 => 2201 (adapter 1)
==> sa_jasper: Running 'pre-boot' VM customizations...
==> sa_jasper: Booting VM...
==> sa_jasper: Waiting for machine to boot. This may take a few minutes...
    sa_jasper: SSH address: 127.0.0.1:2201
    sa_jasper: SSH username: vagrant
    sa_jasper: SSH auth method: private key
    sa_jasper: Warning: Connection timeout. Retrying...
    sa_jasper: Warning: Remote connection disconnect. Retrying...
    sa_jasper: Warning: Remote connection disconnect. Retrying...
==> sa_jasper: Machine booted and ready!
==> sa_jasper: Checking for guest additions in VM...
==> sa_jasper: Configuring and enabling network interfaces...
==> sa_jasper: Mounting shared folders...
    sa_jasper: /vagrant => C:/_worthwhile/vm
    sa_jasper: /vagrant_reporting => C:/_worthwhile/vm/appsuite_reporting
    sa_jasper: /tmp/vagrant-ansible-local => C:/_worthwhile/vm/ansible
==> sa_jasper: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> sa_jasper: to force provisioning. Provisioners marked to run always will still run.

C:\_worthwhile\vm\appsuite_reporting>
GM-Alex commented 9 years ago

Line 60 at plugin.rb checks if the firewall rule for winnfsd is set by using netsh advfirewall firewall show rule name="VagrantWinNFSd-1.0.11">nul. But I'm wondering how this is affected by chrome.

mmodler commented 9 years ago

I tried vagrant up & vagrant suspend with opening and closing chrome and i can't confirm it atm. No plugin.rb:60 error today, but i'll keep watching for it :)

borisschapira commented 9 years ago

+1

GM-Alex commented 9 years ago

Could some of you try to run the netsh command above, with chrome running and without? Maybe the command it the problem.

worthwhileindustries commented 9 years ago

netsh advfirewall firewall show rule name="VagrantWinNFSd-1.0.11">nul

when I run this nothing echos back either chrome on or off. i am not running windows firewall if that is what this shows

smilesrg commented 9 years ago

+1 I have the same issue too

jamiejackson commented 9 years ago

I just started working with the plugin late last week, but I started getting this problem today.

I took out the >nul redirect (I wasn't sure what it's for, and I get no output with it), but here is the non-redirected output with Chrome running (when Vagrant commands were failing) and without Chrome shut down (when Vagrant commands started working again). Spoiler: They're identical:

Chrome running:

15037@ICF2002912 /cygdrive/c/www/hudexchange_vagrant
$ netsh advfirewall firewall show rule name="VagrantWinNFSd-1.0.11"

Rule Name:                            VagrantWinNFSd-1.0.11
----------------------------------------------------------------------
Enabled:                              Yes
Direction:                            Out
Profiles:                             Domain,Private,Public
Grouping:
LocalIP:                              Any
RemoteIP:                             Any
Protocol:                             Any
Edge traversal:                       No
Action:                               Allow

Rule Name:                            VagrantWinNFSd-1.0.11
----------------------------------------------------------------------
Enabled:                              Yes
Direction:                            In
Profiles:                             Domain,Private,Public
Grouping:
LocalIP:                              Any
RemoteIP:                             Any
Protocol:                             Any
Edge traversal:                       No
Action:                               Allow
Ok.

Chrome shut down:

15037@ICF2002912 /cygdrive/c/www/hudexchange_vagrant
$ netsh advfirewall firewall show rule name="VagrantWinNFSd-1.0.11"

Rule Name:                            VagrantWinNFSd-1.0.11
----------------------------------------------------------------------
Enabled:                              Yes
Direction:                            Out
Profiles:                             Domain,Private,Public
Grouping:
LocalIP:                              Any
RemoteIP:                             Any
Protocol:                             Any
Edge traversal:                       No
Action:                               Allow

Rule Name:                            VagrantWinNFSd-1.0.11
----------------------------------------------------------------------
Enabled:                              Yes
Direction:                            In
Profiles:                             Domain,Private,Public
Grouping:
LocalIP:                              Any
RemoteIP:                             Any
Protocol:                             Any
Edge traversal:                       No
Action:                               Allow
Ok.
jamiejackson commented 9 years ago

It seemed to happen more often when Chrome was running, but there was an incident where I'd still get the error even when all Chrome tasks were killed. I've uninstalled the plugin (for now) in order to reliably work with my other Vagrant projects.

worthwhileindustries commented 9 years ago

@jamiejackson yes chrome is an issue whether or not you are using plugins. I'm not sure what chrome does but, often also when running chrome the machine boots up but, and enters an invalid state. It happens regardless of using NFS. Packer uses Vagrant to boot up the machine to configure afaik and I never have any problems with Packer.

jamiejackson commented 9 years ago

@worthwhileindustries: You wrote "yes chrome is an issue whether or not you are using plugins," but my latest claim was the reverse: The vagrant-winnfsd plugin was an issue for me regardless of whether I was using Chrome (though when Chrome was running, there was a higher likelihood that I'd get the error).

worthwhileindustries commented 9 years ago

@jamiejackson Yea I don't have an answer lol. I was just repeating myself I suppose. I'd really like to figure out why I have to close chrome to have vagrant up more smoothly which I should probably investigate myself further and make a new issue. I just don't know if it's an issue with vagrant or the plugins. Should probably just move to a MAC or other linux distro if you are heavily using this.

IbnSaeed commented 9 years ago

I have the same issue on windows 8.1.

just closing the winnsfd console window, and by re entering a vagrant command works.

jamiejackson commented 9 years ago

@worthwhileindustries The rest of my team is on Windows, so my requirement is that it needs to run on Windows. (I, myself, work in a Linux VM, on my corporate-issued win host, but I can't do much Vagrant stuff in the LInux guest. Yeah, I can use the Docker provider in that VM, but creating a Vagrant project that works both in Win hosts and within Linux guests isn't easy, in practice.)

BTW, I'm not relying heavily on this plugin at all--it was just a trial: I was seeing if I could get some improvement to the performance of my sluggish shared directories.

I'll try this plugin again once it's got its kinks worked out a bit more.

FDiskas commented 9 years ago

@GM-Alex I can confirm that to. Thanks @worthwhileindustries

ottowayne commented 9 years ago

Can confirm that closing Chrome fixed it o.O

negativefix commented 8 years ago

I am getting the same error while Opera (WebKit) is running. Closing it, solves the problem.

bdw429s commented 8 years ago

I've started getting this error a lot recently. I'm not sure closing Chrome and trying again would be a very useful test since it always works the second try anyway. I never know when the error will happen so there's not really a control in the experiment. Also, here is the output of the command requested above:

C:\> netsh advfirewall firewall show rule name="VagrantWinNFSd-1.0.11">nul

No rules match the specified criteria

Of course, like I said-- the error goes away the second time so I'm not sure if me running the command above AFTER I've gotten the error is a useful test of what was happening at the time of the error. Let me know if I can add any debugging code into the plugin to log the output of that command at the time the error is happening. I'm not using any firewall.

preciserobot commented 8 years ago

+1