I have created a sample app which read/write from a network file. When the file was attempted to open (using open Linux API), connection to network file was lost. The thread which was stuck on the open method, returns after a long time.
It was observed that for macOS, the maximum return time of the thread was around 10 mins, whereas in Windows and Linux, the maximum timeout was 60 sec and 90 sec.
macOS has a very large timeout before returning the thread with a network failure error. Is this by designed and expected? With a large timeout as 10mins, it's difficult to respond swiftly back to the user.
Bug number: FB20072274 Title: (SMB Disconnect Causes macOS Disk I/O Call open () to Hang for 10 Minutes).
You may have already gotten this through bug feedback, but this is actually a side effect of how the volume was mounted. The default when mounting through "mount_smbfs" is a "hard" mount which, among other things, ends up using the default response timeout (~10 min).
However, you can also mount as a "soft" mount:
mount_smbfs -o soft <url> <mount point>
…at which point syscalls should fail after ~1 min. Soft mount is what the Finder uses (which is why this hadn't come up before), however, if you were mixing mount_smbfs and Finder mounts to the same server. I think the behavior here might actually come from the session itself (not necessarily the individual mount), in which case an existing mount_smbfs might alter the behavior of the Finder mount. Note that this could also be overridden using "forcenewsession" on the mount.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware