15

A third-party program will write files to a SSHFS mounted dir. If the internet connection is lost, the third-party program will likely crash (badly), because all programs trying to access such an SSHFS mounted dir in such a state (when there's no internet connection) are put into what some describe as "uninterruptible sleep". SSHFS has an option to auto-reconnect, but this doesn't help, as the third-party program will still hang (and crash) if the connection is lost (even though when the connection is restored, SSHFS will remount the dir). Autofs will not help, basically it's about the behavior of SSHFS when the connection is lost. Why can't it behave like a network shared directory (Samba or other means) and simply return an error sooner rather than... never?

Are there alternatives to SSHFS if SSHFS can't work as described?

Other info:

OS: I'm using Ubuntu Linux (12.04 LTS)

Andrei
  • 513

3 Answers3

1

Sad issue. I tried sshfs several times in the past.

As soon as the connection is lost, applications accessing files in the mounted folder freezes and crashes. Even Terminals. BUT the applications don't even know that they are waiting. It's something on the kernel-level that cannot handle sshfs telling them to wait forever... even unmount doesn't work and even freezes sometimes because the mounted folder is locked somehow on the filesystem-kernel-level.

Why doesn't this happen when I unplug a USB drive?

This issue exists for years now ...

Auto-reconnect doesn't help if you just cannot re-establish a connection at anytime. (In my case I have kerberos Tickes running out).

Sorry but I have to state: sshfs is unusable!
(except for cases in which a connection is never lost)

I always end up using scp instead. Sad issue

1

sshfs documentation suggests the use of the -o ServerAliveInterval=15. This could lead to data loss, but should return an error after 45 seconds of network interruption.

https://github.com/libfuse/sshfs/blob/master/sshfs.rst#sshfs-hangs-after-the-connection-was-interrupted

Saïmonn
  • 426
0

In short: No - because the freezing is from the application, sshfs failure is graceful - it'll tell the application to wait. - the fact the application doesn't respect this isn't the fault of SSHFS.

The application would do exactly the same, if it was accessing a file on removable storage such as a usb drive, and you removed it. The application needs to capture and handle the timeout events on I/O instead of just getting stuck waiting for the response.

djsmiley2kStaysInside
  • 6,943
  • 2
  • 36
  • 48