I have an Ubuntu 16.04 LTS web server that mounts a Windows file server via Samba. The web server need to be able to occasionally perform tasks that interact with the files on that server. However, we recently had an outage with the Windows file server, which caused the web server to start behaving very poorly. I would hope that the mount going down would simply cause the commands that try to interact with that folder to fail immediately (allowing us to quickly catch and handle the exception), but instead, it appears that interactions with the mount happen very slowly instead.
Here is the entry in /etc/fstab for mounting the share:
//<Windows server hostname>/TPA /mnt/TPA cifs username=tasker,password=<redacted>,domain=<our domain>,sec=ntlm,iocharset=utf8,sec=ntlm 0 0
By "slowly", I mean that if I do ls /mnt
, the command takes roughly 30 seconds to complete before giving me the following message:
user@server:/mnt$ ls
ls: cannot access 'TPA': Host is down
This slowness can be seen in the web app itself, too. If possible, I would like to be able to set up the web app to detect if the share is down and handle that gracefully, but I don't want it to take 30 seconds to do so with every request. Is there a way I can configure things so it can be handled more gracefully?
To make matters more complicated, the web app is actually inside a Docker container that has a volume added that points to /mnt
, which may make things even worse, though I suppose if I solve the issues with the host, then the container should hopefully similarly fall into line.
Any advice would be greatly appreciated!
EDIT: I'll add that for the time being, we've unmounted the offending mount and commented out the line from fstab, and that seems to make it "happy", but ideally I would prefer a solution that isn't so manual.