SAMBA max open files

slis

Cadet
Joined
Feb 25, 2023
Messages
7
Hi

I'm running TrueNAS-SCALE-22.12.1 with SMB shares used in a mixed Mac-Windows-iOS environment.
Recently a photo management application on my Mac (Capture One) failed to make a backup of the library to the SMB share. It just stopped at a random file and bailed out with an error. At the same time mounted shares were kind of dropped/disconnected. Digging into the log files it turned out that the backup process topped the "max open files" parameter in the SMB settings. Default is

max open files = 16424

Doubling the value helped me get through the backup successfully. Can anyone help me figure out what is the reasoning behind this (low?) setting and what are the possible consequences of doubling this limit?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
It's probably protective of memory as more open files cost more memory...

I don't think there would be "too much harm" in increasing it if your system has plenty of RAM.
 

slis

Cadet
Joined
Feb 25, 2023
Messages
7
Here is what samba.org has on this:

max open files (G)​

This parameter limits the maximum number of open files that one smbd(8) file serving process may have open for a client at any one time. This parameter can be set very high (16384) as Samba uses only one bit per unopened file. Setting this parameter lower than 16384 will cause Samba to complain and set this value back to the minimum of 16384, as Windows 7 depends on this number of open file handles being available.
The limit of the number of open files is usually set by the UNIX per-process file descriptor limit rather than this parameter so you should never need to touch this parameter.
Default: max open files = 16384

References to Windows 7 tell me that this is not something that has been looked into for quite some time.
On the other hand, the last sentence in the paragraph makes no sense to me. I don't understand the meaning of it, but I do feel that there is some imbalance, if 'usually set' does not play well with 'you should never need to touch'.
 

Arimil

Cadet
Joined
Mar 28, 2023
Messages
3
I've run into this as well, to me that description seems like something isn't configured correctly. I've also had issues when I open a file, close the program that was then accessing that file, but SMB seems to think the file is now permanently in-use by another program, thus I can't move or rename the file. The only fix I've found is periodically restarting the SMB service.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Looks like there may be some benefit in looking at lock settings for your SMB config:
 
Top