IgnorantGuru / spacefm

SpaceFM File Manager
http://ignorantguru.github.com/spacefm/
GNU General Public License v3.0
487 stars 73 forks source link

spacefm hangs when NFS mounts become unavailable #694

Closed starkgate closed 6 years ago

starkgate commented 6 years ago

When an NFS mount is disconnected and I click on a bookmark or tab that leads to that mount, spacefm hangs until the mount is back online. NFS is present in the "Change detection" blacklist, so what explains this behaviour ? I'd like spacefm to just ignore absent mounts, and keep going, only waiting in the background for them to come back online. I'd like to know if there is a solution to that ? I know spacefm isn't actively maintained anymore, I'm just hoping there's a tweak that would get me the result I want :).

IgnorantGuru commented 6 years ago

In your case, you could create a custom command in Bookmarks (sort of a smart bookmark), and have the custom command poll the mount point, then open it in SpaceFM only when it is available. This way if the custom command's process hangs, it shouldn't hang the SpaceFM process. The user's manual shows how to create custom commands.

In general, SpaceFM's extensible UI thread does interact with the filesystem directly for real-time filesystem context, etc. This means on slower or laggy filesystems (and NFS is about as bad as they get), this may affect the UI. This isn't for lack of trying, and it has been minimized, but an asynchronous i/o layer would need to be developed to avoid this completely. SpaceFM by design doesn't use a third-party API/cache/etc for filesystem access, so it's bolted to the kernel, for better and worse.

On fast filesystems (and a lighter GTK theme), SpaceFM feels very fast and responsive. On filesystems that hang frequently, it can be frustrating to use. It's always possible to use another lightweight file manager in parallel with SpaceFM to help with laggy filesystems.

IgnorantGuru commented 6 years ago

For example, here is a command to test a mount point and open it in a new tab when it responds. Right-click on an existing bookmark and select New|Command. For the command enter:

#!/bin/bash

POINT='/home/user/mount-point'

if ls "$POINT" &>/dev/null; then
    spacefm "$POINT"
fi
starkgate commented 6 years ago

Thank you very much for the advice ! It works wonderfully. The action just runs in the background if the NFS mount is unavailable, but doesn't freeze the rest of the UI. Thank you, again :).

For anyone who might be interested in the same thing, you can also use the following to have spacefm open the directory in the current tab : spacefm -r "$POINT"

The only problem that still might freeze the UI is if you have a tab currently opened in an unexisting NFS mount and inadvertedly switch to it. I don't think that can be avoided, however.