I'm using sshfs 2.4.0 with fuse4x 0.10.0 on a OSX 10.7.3 machine and see what I believe amounts to a resource leak.
I have symlinked the sshfs binary to /sbin/mount_sshfs.
I have multiple mounts setup using autofs with the following options (I have more than these, but this gives a sense of what I'm doing):
/DIR1 -fstype=sshfs,auto_cache,allow_other,sshfs_debug,reconnect,defer_permissions,negative_vncache,volname=Dir1 USER@SERVER:/DIR1
/DIR2 -fstype=sshfs,auto_cache,allow_other,sshfs_debug,reconnect,defer_permissions,negative_vncache,volname=Dir2 USER@SERVER:/DIR2
After a while I start seeing this in the log:
Apr 26 19:31:23 monoco com.apple.automountd[10836]: t0x10b40a000 fork_exec: /sbin/mount_sshfs -o nobrowse -o nosuid,nodev -o auto_cache,allow_other,sshfs_debug,reconnect,defer_permissions,negative_vncache,volname=Dir1 -o automounted USER@SERVER:/DIR1 /DIR1
Apr 26 19:31:23 monoco com.apple.automountd[10836]: SSHFS version 2.4.0
Apr 26 19:31:23 monoco com.apple.automountd[10836]: fuse4x: failed to open device file
Apr 26 19:31:23 monoco automountd[10836]: mount of /DIR1 failed
Apr 26 19:31:23 monoco com.apple.automountd[10836]: t0x10b40a000 fork_exec: returns exit status 1
Apr 26 19:31:23 monoco com.apple.automountd[10836]: t0x10b40a000 MOUNT REPLY : status=1, AUTOFS_DONE
A little later I start seeing these messages (and they continue until I kill the sshfs processes):
Apr 27 00:29:56 monoco automountd[15039]: Can't open /dev/autofs: Resource busy
Apr 27 00:29:56 monoco com.apple.launchd[1] (com.apple.automountd[15039]): Exited with code: 2
Apr 27 00:29:56 monoco com.apple.launchd[1] (com.apple.automountd): Throttling respawn: Will start in 10 seconds
After doing an lsof on /dev/autofs I see there are 24 sshfs processes with it open (24 is in fact the FUSE4X_NDEVICES value). However, if I look at the commands for those processes, many of them are for the same mount (about 5 distinct mounts total across the 24 processes).
I loaded one of them into gdb and got the stack traces below. I believe Thread 3 is the interesting one. It seems to have invoked a read syscall and never returns.
This is pretty reproducible, though it takes an hour or two sometimes.
So I'm curious -- do my options above look reasonable? Is there any way to turn on more debugging for the sshfs process? Anyone heard of this sort of thing before or have an inkling as to what might be going on?
Thanks,
nall.
Thread 1
(gdb) where
#0 0x00007fff866fce42 in __semwait_signal ()
#1 0x00007fff8a25f97e in pthread_join ()
#2 0x000000010001abc6 in fuse_session_loop_mt ()
#3 0x000000010000489d in ?? ()
#4 0x00000001000017cc in ?? ()
Thread 2
(gdb) where
#0 0x00007fff866fd00e in __sigsuspend ()
#1 0x00007fff8a25fd3f in pause ()
#2 0x000000010001af28 in fuse_do_work ()
#3 0x00007fff8a2a98bf in _pthread_start ()
#4 0x00007fff8a2acb75 in thread_start ()
Thread 3
(gdb) where
#0 0x00007fff866fdaf2 in read ()
#1 0x00000001000061bf in ?? () // do_read
#2 0x0000000100005b5b in ?? () // sftp_read
#3 0x0000000100007571 in ?? () // process_one_request
#4 0x00007fff8a2a98bf in _pthread_start ()
#5 0x00007fff8a2acb75 in thread_start ()
But I get this on the Console:/DIR1 -fstype=sshfs,s,auto_cache,... USER@SERVER:/DIR1
Apr 27 10:29:47 didot com.apple.automountd[74422]: fuse: unknown option `s'
-fstype=sshfs,-s,auto_cache,...
Depending on if the argument parser in sshfs can handle it that is. Using the built-in argument parsers service in FUSE provides this feature.