[Samba] smbd: Too many open files

Frantisek Hanzlik f-hanzlik at volny.cz
Fri Jun 7 13:39:03 GMT 2002


Hi all,

can any help with our strong problem:
we are using Samba on Linux as fileserver for Win2k clients running CAD software
"Solid Edge". This program opens many files and on big projects freeze.

We tried configuration:
- samba 2.2.3a or 2.2.4
- RH 7.2 or 7.3; kernel 2.4.18, 2.4.19 up to -pre10-ac2
- i686/1GHz CPU, 512 MB RAM
- "/proc/sys/fs/file-max" from default 8192 up to 20000 or 30000,
- smb.conf "max open files" from default 10000 to 20000 or 30000 or for debugiing to 1000
- when I periodically test "/proc/sys/fs/file-nr", then number of used file handles is
	always less than 150, but number of allocated file handles is any time near same
	(about 500), but then start quick increased and stop on slightly more than value
	"max open files" from "smb.conf"
- when I set debugging in smb.conf, in station log is suspicious record about closing
	file with filedescriptor fd=-1 :

[2002/06/07 14:33:53, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 14:33:53, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.dft read=Yes write=No (numopen=1)
   reply_ntcreate_and_X: fnum = 5004, open name = O/a1/KO-I_X8-eh.dft
   switch message SMBclose (pid 6617)
   pipe name srvsvc pnum=71e8 (pipes_open=1)
[2002/06/07 14:33:53, 5] smbd/pipes.c:reply_pipe_close(255)
   reply_pipe_close: pnum:71e8
[2002/06/07 14:33:53, 4] rpc_server/srv_pipe_hnd.c:close_rpc_pipe_hnd(955)
   closed pipe name srvsvc pnum=71e8 (pipes_open=0)
   allocated file structure 909, fnum = 5005 (2 used)
[2002/06/07 14:33:53, 5] smbd/open.c:open_mode_check(574)
   open_mode_check: oplock_request = 0, breaking oplock (3) on file O/a1/KO-I_X8-eh.dft, dev = 900, inode = 
1556900
   Current oplocks_open (exclusive = 1, levelII = 0)
   Current oplocks_open (exclusive = 1, levelII = 0)
   switch message SMBclose (pid 6617)
[2002/06/07 14:33:53, 3] smbd/reply.c:reply_close(3019)
   close fd=24 fnum=5004 (numopen=1)
[2002/06/07 14:33:53, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.dft (numopen=0)
   Current oplocks_open (exclusive = 0, levelII = 0)
   initial_break_processing: cannot find open file with dev = 900, inode = 1556900 file_id = 41allowing break 
to succeed.
   Current exclusive_oplocks_open = 0
[2002/06/07 14:33:53, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 14:33:53, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.dft read=Yes write=No (numopen=1)
   reply_ntcreate_and_X: fnum = 5005, open name = O/a1/KO-I_X8-eh.dft
   switch message SMBclose (pid 6617)
[2002/06/07 14:33:53, 3] smbd/reply.c:reply_close(3019)
   close fd=-1 fnum=5005 (numopen=1)				<<<=========== HERE
[2002/06/07 14:33:53, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.dft (numopen=0)
   allocated file structure 910, fnum = 5006 (1 used)
[2002/06/07 14:33:53, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 14:33:53, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.dft read=Yes write=No (numopen=1)
   reply_ntcreate_and_X: fnum = 5006, open name = O/a1/KO-I_X8-eh.dft
   switch message SMBclose (pid 6617)
[2002/06/07 14:33:53, 3] smbd/reply.c:reply_close(3019)
   close fd=24 fnum=5006 (numopen=1)
[2002/06/07 14:33:53, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.dft (numopen=0)


- after several thousand files open/close, when file descriptors are numbers up to cca 60,
	start file descriptors increased :

[2002/06/07 15:02:35, 3] smbd/reply.c:reply_close(3019)
   close fd=27 fnum=4569 (numopen=4)
[2002/06/07 15:02:35, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/SoucastiMS/SEALING/N029401C 25x47x10.par (numopen=3)
   switch message SMBclose (pid 6617)
[2002/06/07 15:02:35, 3] smbd/reply.c:reply_close(3019)
   close fd=30 fnum=4570 (numopen=3)
[2002/06/07 15:02:35, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/x/MRA45.par (numopen=2)
   switch message SMBclose (pid 6617)
[2002/06/07 15:02:35, 3] smbd/reply.c:reply_close(3019)
   close fd=31 fnum=4571 (numopen=2)
[2002/06/07 15:02:35, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/Zmeny PSP2/A401/KO_KLIN-KO-PSP2.par (numopen=1)
   allocated file structure 476, fnum = 4572 (3 used)
[2002/06/07 15:02:45, 5] smbd/open.c:open_mode_check(574)
   open_mode_check: oplock_request = 3, breaking oplock (3) on file O/a1/KO-I_X8-eh.cfg, dev = 900, inode = 
1556659
   Current oplocks_open (exclusive = 2, levelII = 0)
   Current oplocks_open (exclusive = 2, levelII = 0)
   lockingX fnum=4884 type=16 num_locks=2 num_ulocks=0
   Current oplocks_open (exclusive = 2, levelII = 0)
   reply_lockingX: oplock break reply (0) from client for fnum = 4884
   Current oplocks_open (exclusive = 1, levelII = 0)
   Current exclusive_oplocks_open = 1
[2002/06/07 15:02:45, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:02:45, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.cfg read=Yes write=No (numopen=2)
   reply_ntcreate_and_X: fnum = 4572, open name = O/a1/KO-I_X8-eh.cfg
   switch message SMBclose (pid 6617)
[2002/06/07 15:02:45, 3] smbd/reply.c:reply_close(3019)
   close fd=20 fnum=4572 (numopen=2)
[2002/06/07 15:02:45, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.cfg (numopen=1)
   allocated file structure 477, fnum = 4573 (3 used)
[2002/06/07 15:03:26, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:26, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.cfg read=Yes write=No (numopen=2)
   reply_ntcreate_and_X: fnum = 4573, open name = O/a1/KO-I_X8-eh.cfg
   switch message SMBclose (pid 6617)
[2002/06/07 15:03:26, 3] smbd/reply.c:reply_close(3019)
   close fd=26 fnum=4573 (numopen=2)
[2002/06/07 15:03:26, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.cfg (numopen=1)
   allocated file structure 478, fnum = 4574 (3 used)
[2002/06/07 15:03:27, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:27, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.cfg read=Yes write=No (numopen=2)
   reply_ntcreate_and_X: fnum = 4574, open name = O/a1/KO-I_X8-eh.cfg
   switch message SMBclose (pid 6617)
[2002/06/07 15:03:27, 3] smbd/reply.c:reply_close(3019)
   close fd=27 fnum=4574 (numopen=2)
[2002/06/07 15:03:27, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.cfg (numopen=1)
   allocated file structure 479, fnum = 4575 (3 used)
[2002/06/07 15:03:27, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:27, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.cfg read=Yes write=No (numopen=2)
   reply_ntcreate_and_X: fnum = 4575, open name = O/a1/KO-I_X8-eh.cfg
   switch message SMBclose (pid 6617)
[2002/06/07 15:03:27, 3] smbd/reply.c:reply_close(3019)
   close fd=28 fnum=4575 (numopen=2)
[2002/06/07 15:03:27, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.cfg (numopen=1)
   allocated file structure 480, fnum = 4576 (3 used)
[2002/06/07 15:03:27, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:27, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.cfg read=Yes write=No (numopen=2)
   reply_ntcreate_and_X: fnum = 4576, open name = O/a1/KO-I_X8-eh.cfg
   switch message SMBclose (pid 6617)
[2002/06/07 15:03:27, 3] smbd/reply.c:reply_close(3019)
   close fd=30 fnum=4576 (numopen=2)
[2002/06/07 15:03:27, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.cfg (numopen=1)
   allocated file structure 481, fnum = 4577 (3 used)
[2002/06/07 15:03:27, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:27, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.cfg read=Yes write=No (numopen=2)
   reply_ntcreate_and_X: fnum = 4577, open name = O/a1/KO-I_X8-eh.cfg
   switch message SMBclose (pid 6617)
[2002/06/07 15:03:27, 3] smbd/reply.c:reply_close(3019)
   close fd=31 fnum=4577 (numopen=2)
[2002/06/07 15:03:27, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.cfg (numopen=1)
   allocated file structure 482, fnum = 4578 (3 used)
[2002/06/07 15:03:27, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:27, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.cfg read=Yes write=No (numopen=2)
   reply_ntcreate_and_X: fnum = 4578, open name = O/a1/KO-I_X8-eh.cfg
   switch message SMBclose (pid 6617)
[2002/06/07 15:03:27, 3] smbd/reply.c:reply_close(3019)
   close fd=32 fnum=4578 (numopen=2)
[2002/06/07 15:03:27, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.cfg (numopen=1)
   allocated file structure 483, fnum = 4579 (3 used)
[2002/06/07 15:03:27, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:27, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.cfg read=Yes write=No (numopen=2)
   reply_ntcreate_and_X: fnum = 4579, open name = O/a1/KO-I_X8-eh.cfg
   switch message SMBclose (pid 6617)
[2002/06/07 15:03:27, 3] smbd/reply.c:reply_close(3019)
   close fd=33 fnum=4579 (numopen=2)
[2002/06/07 15:03:27, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.cfg (numopen=1)
   allocated file structure 484, fnum = 4580 (3 used)
[2002/06/07 15:03:27, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:27, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.cfg read=Yes write=No (numopen=2)
   reply_ntcreate_and_X: fnum = 4580, open name = O/a1/KO-I_X8-eh.cfg
   switch message SMBclose (pid 6617)
[2002/06/07 15:03:27, 3] smbd/reply.c:reply_close(3019)
   close fd=34 fnum=4580 (numopen=2)
[2002/06/07 15:03:27, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.cfg (numopen=1)
   allocated file structure 485, fnum = 4581 (3 used)
[2002/06/07 15:03:27, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:27, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.cfg read=Yes write=No (numopen=2)
   reply_ntcreate_and_X: fnum = 4581, open name = O/a1/KO-I_X8-eh.cfg
   switch message SMBclose (pid 6617)
[2002/06/07 15:03:27, 3] smbd/reply.c:reply_close(3019)
   close fd=35 fnum=4581 (numopen=2)
[2002/06/07 15:03:27, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.cfg (numopen=1)


- numbers of allocated file structure returned from "bitmap_find" in "files.c" are
	near "max open files" from "smb.conf", as if fd exhausted.
	And when fd number reach "max open files" + MAX_OPEN_FUDGEFACTOR, then
	in station log appear message "Too many open files" :

   allocated file structure 461, fnum = 4557 (3 used)
[2002/06/07 15:03:49, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:49, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.cfg read=Yes write=No (numopen=2)
   reply_ntcreate_and_X: fnum = 4557, open name = O/a1/KO-I_X8-eh.cfg
   switch message SMBclose (pid 6617)
[2002/06/07 15:03:49, 3] smbd/reply.c:reply_close(3019)
   close fd=1008 fnum=4557 (numopen=2)
[2002/06/07 15:03:49, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.cfg (numopen=1)
   allocated file structure 462, fnum = 4558 (3 used)
[2002/06/07 15:03:49, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:49, 2] smbd/open.c:open_file(230)
   johny opened file O/a1/KO-I_X8-eh.cfg read=Yes write=No (numopen=2)
   reply_ntcreate_and_X: fnum = 4558, open name = O/a1/KO-I_X8-eh.cfg
   switch message SMBclose (pid 6617)
[2002/06/07 15:03:49, 3] smbd/reply.c:reply_close(3019)
   close fd=1009 fnum=4558 (numopen=2)
[2002/06/07 15:03:49, 2] smbd/close.c:close_normal_file(211)
   johny closed file O/a1/KO-I_X8-eh.cfg (numopen=1)
   allocated file structure 463, fnum = 4559 (3 used)
[2002/06/07 15:03:49, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:49, 3] smbd/open.c:open_file(162)
   Error opening file O/a1/KO-I_X8-eh.cfg (Too many open files) (local_flags=0) (flags=0)
   error string = Too many open files
   allocated file structure 464, fnum = 4560 (3 used)
[2002/06/07 15:03:49, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:49, 3] smbd/open.c:open_file(162)
   Error opening file O/a1/KO-I_X8-eh.cfg (Too many open files) (local_flags=0) (flags=0)
   error string = Too many open files
   allocated file structure 465, fnum = 4561 (3 used)
[2002/06/07 15:03:49, 4] smbd/open.c:open_file_shared1(891)
   calling open_file with flags=0x0 flags2=0x0 mode=0764
[2002/06/07 15:03:49, 3] smbd/open.c:open_file(162)
   Error opening file O/a1/KO-I_X8-eh.cfg (Too many open files) (local_flags=0) (flags=0)
   error string = Too many open files


- its all, sorry for long log listing.
	I'm not familiar with C and not know internal mechanism in samba and OS.
	It is bug in my "smb.conf", smbd daemon, Linux OS or Win2k client?
	Or can any advise me on next progress?
	
Thanks in advance,
Frantisek Hanzlik






More information about the samba mailing list