You are not logged in.

#1 2019-11-01 13:12:50

themusicalduck
Member
Registered: 2011-07-04
Posts: 123

Preventing desktop lockups when using network mounts.

I have a bit of a strange setup on my laptop when I'm not at home. I have a dedicated server from a hosting provider with OpenVPN running. My NAS at home connects to the VPN network and my server mounts some NFS exports from the NAS. Then I create some SSHFS mounts from my laptop to the server so that I can access those files (I don't connect the laptop via VPN, because it is my work laptop).

It's only small amounts of data. Mostly so that I can listen to my music saved at home with Clementine. All mounts are mounted as read only.

This works pretty well, 95% of the time. Sometimes though the connection gets interrupted along the way, or the NAS needs to be rebooted (it's a crap NAS, don't buy stuff from Synology..). Often this means that Clementine gets into "disk sleep" state because it's waiting for a file. At that point I can either wait 20 minutes or so for it to unlock itself, try to lazy unmount the mounts, or force reboot the laptop (because disk sleep state is uninterruptible, it never shutdowns manually).

The problem is that it's not only Clementine that locks up, usually Gnome does too entirely and I have to lose whatever I'm working on.

Is there an option or something I can do to make these lockups less likely to happen? Can I set an option somewhere that says "if this mount is hanging, give up quickly"? It isn't vital data but it's mounted as read only anyway, so data integrity shouldn't be a worry.

Thank you.

Offline

#2 2019-11-01 13:44:11

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: Preventing desktop lockups when using network mounts.

"man 5 nfs", look for the "soft" option.

Offline

#3 2019-11-03 02:15:55

themusicalduck
Member
Registered: 2011-07-04
Posts: 123

Re: Preventing desktop lockups when using network mounts.

Thanks. I've set that up on the NFS side at least.

Is it likely the NFS mounts were causing the lockups? The NFS mount is between the server and my NAS. Is there an option on the SSHFS side that I should set too? It doesn't seem like there is an equivalent soft option for SSHFS.

Offline

#4 2019-11-03 06:25:45

snailman153624
Member
Registered: 2019-09-24
Posts: 11

Re: Preventing desktop lockups when using network mounts.

themusicalduck wrote:

Thanks. I've set that up on the NFS side at least.

Is it likely the NFS mounts were causing the lockups? The NFS mount is between the server and my NAS. Is there an option on the SSHFS side that I should set too? It doesn't seem like there is an equivalent soft option for SSHFS.

I have had this same issue, and I traced it down to the file system waiting for DNS to resolve the host....the soft option and/or a short timeout can help.  Cinnamon, gnome-terminal, and nautilus (ahem, I mean "files") all have the same behavior.  Seems like a design flaw to let a network file share prevent the CPU from doing other work.

I also made some tweaks to DNS config (nsswitch.conf) to get around the problems resolving local domains.

Offline

#5 2019-11-03 06:33:20

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,390

Re: Preventing desktop lockups when using network mounts.

Check my workaround via bindfs:
https://bbs.archlinux.org/viewtopic.php … 9#p1691299

Last edited by kokoko3k (2019-11-03 06:35:34)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#6 2019-11-03 07:28:15

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: Preventing desktop lockups when using network mounts.

Sorry, missed the sshfs part.

You could eg. pass "ServerAliveInterval=1,ServerAliveCountMax=3,reconnect,delay_connect" as sshfs options (see man sshfs; man ssh_config) - this will ping the server every second and if that fails three times in a row (so after three seconds) it will disconnect and automatically reconnect (what will however break opened files!) - you may want to play w/ the actual values.

Offline

#7 2019-11-04 11:19:47

themusicalduck
Member
Registered: 2011-07-04
Posts: 123

Re: Preventing desktop lockups when using network mounts.

Thanks everyone.

I'm trying your options Seth and will see if it helps.

I also read through the sshfs wiki page and decided to use an automount fstab entry (I was running it manually before). That might make it a bit more robust too.

Offline

Board footer

Powered by FluxBB