winnfsd / vagrant-winnfsd

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

Freezing on launching second VM with NFS using Windows 10 and Vagrant 1.8.1 #83

Closed hussainweb closed 7 years ago

hussainweb commented 8 years ago

This is somewhat similar to #79.

When starting another VM, it freezes when the machine boots up at Mounting NFS shared folders.... It works fine if I close the other VM and start this one. I am using Vaprobash which has the following definition:

config.vm.synced_folder ".", "/vagrant",
  id: "core",
  :nfs => true,
  :mount_options => ['nolock,vers=3,udp,noatime,actimeo=2,fsc']

I am guessing it is obvious but I tried to start the first VM after second one booted successfully and it froze at the same point. I think there is something blocking the second mount. I am happy to provide more information if necessary.

hussainweb commented 8 years ago

For completeness, this is the error after a few moments:

The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed!

mount -o 'nolock,vers=3,udp,noatime,actimeo=2,fsc' 10.20.1.1:'/D/Internet/drustats' /var/www

Stdout from the command:

Stderr from the command:

stdin: is not a tty mount.nfs: access denied by server while mounting 10.20.1.1:/D/Internet/drustats

alexsapran commented 8 years ago

getting the same error with win 10 and vagrant 1.8.1

nbyloff commented 8 years ago

I get this error a lot as well (Win10). Every time I halt a vagrant machine, and start a new one, it locks up. This is always fixable if I go and stop the winnfsd.exe process and reload the box.

For me, the simplest fix would be for the winnfsd process to restart on every new vagrant up for those times when I forget to kill the service manually.

HollyIT commented 8 years ago

This is actually a problem in the winnfsd.exe itself. It crashes on doing a second mount. I've got an issue opened on that project page:

https://github.com/winnfsd/winnfsd/issues/13

nbyloff commented 8 years ago

@HollyIT how did you get vagrant to use the VS debug mode winnfsd process? I ran that project you linked to in debug mode in VS 2015, and it just starts and stops with no errors.

Not very handy in VS, but from the error you posted, it looks like the place to start is with a missing path?

HollyIT commented 8 years ago

I actually ran it without Vagrant and doing the mounts from my CentOS7 machine (dedicated machine). How the vagrant plugin adds the mounts is through a text file that is added read in by winnfsd.exe. So what I did was create a text file with the paths I want mounted (simply one path per line), then put the arguments in VS Debug options to pass as command line parameters (debugging options under the solution properties):

-log on -pathFile z:\winnfsd\exports.txt

The problem isn't a null path. Here's the actual code block causing the problem (in filetree.cpp):

tree_node_<FILE_ITEM>* CFileTree::findNodeFromRootWithPath(char *path)
{
    if (topNode.node == NULL){
        return NULL;
    }
    std::string sPath(path);
    if (sPath == std::string(topNode->path)) {
        return topNode.node;
    }
    std::string splittedString = sPath.substr(strlen(topNode->path) + 1);
    return findNodeWithPathFromNode(splittedString, topNode.node);
}

I haven't backtraced, but even with a new mount this is being called against the old mount paths, but the basic scenario is that the path of the new mount is the same length as the path of the old mount, so when it hits the sPath.substr(strlen(topNode->path) + 1), you're now at an illegal string length.

I did try with mounts of different lengths as well. That gets to a much more obscure/generic error in memcpy.

Honestly it appears as though winnfsd.exe simply isn't treating separate mount points as actual being separate. They just all get treated as the initial mount, despite winnfsd showing the separate mounts in the logging when it's started.

nbyloff commented 8 years ago

Yeah I was trying to do it through VS Debug options too, but it throws an error trying to read the path files in my exports.txt file in the MountProg.cpp. Sometimes it breaks on this line m_PathMap[pathAlias] = path; and sometimes the link right before it: m_PathMap.count. This is obviously something wrong with my debugging setup on Windows.

void CMountProg::Export(char *path, char *pathAlias)
{
    path = FormatPath(path, FORMAT_PATH);

    if (path != NULL) {
        pathAlias = FormatPathAlias(pathAlias);

        if (m_PathMap.count(pathAlias) == 0) {
            m_PathMap[pathAlias] = path;
            printf("Path #%i is: %s, path alias is: %s\n", m_PathMap.size(), path, pathAlias);
        } else {
            printf("Path %s with path alias  %s already known\n", path, pathAlias);
        }
    }

}

It's a shame because winnfsd project looks dead. There hasn't been any commits in 6 months, and the owner doesn't respond to issues. Hopefully someone figures it out. I notice a ton of issues that all stem from this one bug online, but no one has fixed it. Thanks for taking the initiative @HollyIT and at least finding the source of the problem.

marcharding commented 8 years ago

This should be fixed with v1.2.0. Give it a try.

marcharding commented 7 years ago

Fixed with v1.2.0