[Samba] Re: Memory leak in 3.0.22?

Mark Cullen mark.r.cullen at gmail.com
Mon Jun 26 00:38:47 GMT 2006


Mark Cullen wrote:
> Hi,
> 
> I have just switched from FreeBSD 4.11 using 3.0.21b to NetBSD 3.0.1 
> using 3.0.22. With the same configuration, and the same clients, I am 
> now seeing what appears to be some rather large memory leakage [ I am 
> not sure if this is the fault of Samba or NetBSD ]. Eventually the 
> process will run out of memory (machine only has 256MB of RAM) and the 
> Windows clients (2000, SP4 and all the latest updates) pop up a message:
> 
> "Insufficient system resources exist to complete the requested service"
> 
> At which point the Samba server becomes unresponsive to the current user 
> logged in. At the same time, I am seeing alot of errors in the logs 
> regarding memory allocation errors:
> 
> ---
> [..snip extract..]
> 
> [2006/06/25 22:03:48, 0] lib/util.c:Realloc(969)
>   Memory allocation error: failed to expand to 4896 bytes
> [2006/06/25 22:03:48, 0] lib/util.c:Realloc(969)
>   Memory allocation error: failed to expand to 4896 bytes
> [2006/06/25 22:03:48, 0] lib/util.c:Realloc(969)
>   Memory allocation error: failed to expand to 4896 bytes
> [2006/06/25 22:03:58, 0] lib/util.c:Realloc(969)
>   Memory allocation error: failed to expand to 4136 bytes
> [2006/06/25 22:03:58, 0] lib/util.c:Realloc(969)
>   Memory allocation error: failed to expand to 4136 bytes
> [2006/06/25 22:03:58, 0] lib/util.c:Realloc(969)
>   Memory allocation error: failed to expand to 4136 bytes
> [2006/06/25 22:03:58, 0] lib/util.c:Realloc(969)
>   Memory allocation error: failed to expand to 4136 bytes
> [2006/06/25 22:03:58, 0] lib/util.c:Realloc(969)
>   Memory allocation error: failed to expand to 4136 bytes
> [2006/06/25 22:03:59, 0] lib/util.c:Realloc(969)
>   Memory allocation error: failed to expand to 4120 bytes
> [2006/06/25 22:03:59, 0] lib/util.c:Realloc(969)
>   Memory allocation error: failed to expand to 4120 bytes
> ---
> 
> The smbd process memory usage according to `top` at this time:
> 
> ---
> 28795 admin       2    0   130M   58M select     5:31  0.00%  0.00% smbd
> ---
> 
> I never had this problem with FreeBSD 4.11 and 3.0.21b. Another user 
> logged in is currently sitting at:
> 
> ---
> 10090 donna       2    0    52M 2704K select     3:25  0.00%  0.00% smbd
> ---
> 
> I have logged back on and I am instantly seeing:
> 
> ---
> 25971 admin       2    0    24M 4040K select     0:22  0.00%  0.00% smbd
> ---
> 
> Something doesn't seem quite right here!
> 
> 
> I'm not sure what kind of info you need, but I have attached my smb.conf 
> (it's a bit messy, perhaps this issue is just a misconfiguration 
> somewhere?) to get started. If anything else is required (it didn't dump 
> a core so I have no backtrace or anything) I will try my best to provide 
> it.
> 
> ---
> #======================= Global Settings 
> =====================================
> [global]
>         workgroup = PIE-NET
>         netbios name = BONE
>         server string = Login Server
>         hosts allow = 10. 127.
>         log file = /var/log/samba/samba.%m
>         max log size = 500
> 
>         csc policy = disable
> 
>         security = user
>         encrypt passwords = yes
>         passdb backend = smbpasswd
> #       socket options = TCP_NODELAY SO_RCVBUF=65535 SO_SNDBUF=65535
> #       interfaces = 10.0.0.0/8 127.0.0.0/8
>         os level = 34
>         local master = yes
>         domain master = yes
>         preferred master = yes
>         domain logons = yes
>         logon script = %G\connect.bat
>         logon path = \\%L\profiles\%u
>         logon home = \\%L\nt
> 
>         null passwords = yes
> #       unix password sync = yes
> #       passwd program = /usr/bin/passwd %u
> 
>         utmp = no
>         nt acl support = yes
> 
> #============================ Share Definitions 
> ==============================
> 
> [unix]
>         comment = Unix Home
>         volume = Unix Home
>         path = /home/%u
>         read only = no
>         directory mode = 0700
>         create mode = 0700
> 
> [nt]
>         comment = NT Home
>         volume = NT Home
>         path = /home/%u/.NT
>         read only = no
>         directory mode = 0700
>         create mode = 0700
>         csc policy = disable
> 
> [userhome]
>         comment = User Homes
>         path = /home
>         browsable = no
>         read only = no
>         admin users = @admin
>         valid users = @admin
>         csc policy = disable
> 
> [netlogon]
>         comment = Network Logon Service
>         path = /samba/netlogon
>         browsable = no
>         read only = no
>         directory mode = 0755
>         create mode = 0755
>         acl check permissions = no
>         map readonly = yes
>         csc policy = disable
> 
> [profiles]
>         comment = Samba Roaming Profiles
>         path = /samba/profiles
>         browsable = no
>         read only = no
>         create mode = 0700
>         directory mode = 0700
>         admin users = @admin
>         profile acls = no
>         csc policy = disable
> 
> [www]
>         comment = WWW
>         path = /var/www
>         browsable = no
>         read only = no
>         valid users = @admin
>         admin users = @admin
>         csc policy = disable
> 
> [vh]
>         comment = Virtual Hosts
>         path = /var/vh
>         read only = no
>         admin users = @admin
>         valid users = @admin
>         browsable = no
>         csc policy = disable
> 
> [admtools]
>         comment = Administration Tools
>         path = /samba/admtools
>         browsable = no
>         read only = no
>         admin users = @admin
>         valid users = @admin
>         csc policy = disable
> 
> [spare]
>         comment = RAID left over
>         path = /spare
>         browsable = no
>         read only = no
>         admin users = @admin
>         valid users = @admin
>         create mode = 0700
>         directory mode = 0700
>         csc policy = disable
> 
> Thanks in advance,
> Mark
> 

A quick follow up. It appears I can slowly grow the memory usage by 
refreshing a Samba share in explorer (holding down F5 for a few 
seconds). It also seems to be related to how many files are in the 
directory, I think. If I do it with a directory with ~300 files in it 
increases fairly rapidly compared to a directory with ~10.

~300 files
==========
admin     6305  0.4  2.5 19884  6384 ?      S    12:43AM   0:23.97 
/usr/pkg/sbin/smbd -D
[... 10 refreshes later ...]
admin     6305  1.6  2.6 20124  6644 ?      S    12:43AM   0:24.30 
/usr/pkg/sbin/smbd -D

~10 files
=========
admin     6305  0.9  2.6 20164  6716 ?      S    12:43AM   0:24.39 
/usr/pkg/sbin/smbd -D
[... 10 refreshes later ...]
admin     6305  0.7  2.6 20164  6716 ?      S    12:43AM   0:24.42 
/usr/pkg/sbin/smbd -D

Rather unscientific I know...



More information about the samba mailing list