jacobsa / fuse

A Go package for implementing a FUSE file system.
Apache License 2.0
488 stars 106 forks source link

Hangs when using with autofs #22

Open lev-kuznetsov opened 7 years ago

lev-kuznetsov commented 7 years ago

I'm having trouble mounting on demand with autofs, it hangs when trying to mount such as when trying to list the mount folder contents. I'm doing this with gcsfuse google buckets implementation, I have a docker container set up with a test, just add service account details and your bucket name:

$ cat Dockerfile 
FROM levkuznetsov/gcsfuse-docker

ADD service-account.json /etc/gcloud/service-account.json
ADD auto.gcsfuse /etc/autofs/auto.gcsfuse

$ cat auto.gcsfuse 
dfci-mev-def-12345-678  -fstype=gcsfuse,rw,key_file=/etc/gcloud/service-account.json    :dfci-mev-def-12345-678

Where dfci-mev-def-12345-678 is my bucket and the Google service account is in service-account.json. Running in privileged mode and the autofs4 module loaded on the host. Output from gcsfuse is:

attempting to mount entry /mnt/dfci-mev-def-12345-678
>> Calling gcsfuse with arguments: -o rw --key-file /etc/gcloud/service-account.json dfci-mev-def-12345-678 /mnt/dfci-mev-def-12345-678
>> Using mount point: /mnt/dfci-mev-def-12345-678
>> Opening GCS connection...
>> Opening bucket...
>> Mounting file system...

and then it just hangs forever. I believe it's blocking in mount.go#Mount but I have no idea why. I'm able to mount the bucket normally within the container

jacobsa commented 7 years ago

Unfortunately I'm unlikely to be able to help you figure out what's going on here. If you root cause this let me know, and I'm happy to discuss how to work around or fix it. You may find googlecloudplatform/gcsfuse#189 interesting.

lev-kuznetsov commented 7 years ago

So far I've been able to trace it down that it is indeed happening in mount.go#Mount, I haven't been able to get any logging statements to work past that, I have never worked with Go before

jacobsa commented 7 years ago

It seems unlikely (but not impossible) that the problem is in the Go code itself. You might try looking at the kernel stacks (/proc/<pid>/stack) for the various threads of the Go program to see what syscall it's hanging in, if any. You might also try getting a Go-level traceback by killing with SIGQUIT.

FossPrime commented 3 years ago

It seems unlikely (but not impossible) that the problem is in the Go code itself. You might try looking at the kernel stacks (/proc/<pid>/stack) for the various threads of the Go program to see what syscall it's hanging in, if any. You might also try getting a Go-level traceback by killing with SIGQUIT.

Turned out to be an oversight... https://github.com/GoogleCloudPlatform/gcsfuse/commit/e2cd3dcff5c2741e7cb89e1324e5d5e7f890d75b#r18826869

Can we replace it with a comment instead of a full io block?? this also breaks Mac OS Auto FS

vitalif commented 1 year ago

I just checked the same thing with geesefs based on jacobsa/fuse with that os.Stat commented out with systemd .automount unit... It hangs even without that os.Stat() :)

I.e. when I try to do ls /path/to/mountpoint it just hangs even though GeeseFS reports that it mounted the FS successfully.

Moreover, usual C libfuse also has the same stat() call. So if it was the cause then no FUSE filesystems would work with automounters... But I don't know. Maybe all of them really don't work :)