Hi! Our Samba file server seems to have a memory leakage. We are using samba as file server out of the box (debian sarge) on kernel 2.6.16.31. After a while users who have some shares and files open are acquiring more and more memory until the smbd dies. Here is a small shortcut from top: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 13843 gxxxxx 16 0 51792 44m 2552 S 0.3 17.8 0:22.97 smbd 13840 bxxxxx 17 0 31400 25m 2764 S 0.7 10.0 2:42.78 smbd smbd is allocation and more memory. We are using user security and smbpasswd as password backend. The output from 'smbcontrol 13843 pool-usage' shows: global talloc allocations in pid: 13843 name chunks bytes ---------------------------------------- -------- -------- msg_pool_usage 1 159 lp_talloc 2 2 connection_struct 1 1844 pipe spoolss 0x922dfb0 0 0 pipe spoolss 0x83f4380 0 0 connection_struct 1 1844 connection_struct 1 1844 passdb internal SAM_ACCOUNT allocation 19 493 passdb internal SAM_ACCOUNT allocation 17 503 pdb_context internal allocation context 5 1513 passdb internal SAM_ACCOUNT allocation 8 397 ---------------------------------------- -------- -------- TOTAL 55 8599 Does anybody have an idea where to start? A similar problem was described in http://lists.samba.org/archive/samba/2005-October/112991.html but unfortunately there was no solution given. Any help appreciated Dirk
On Tue, Nov 14, 2006 at 10:34:31AM +0100, Dirk Becker wrote:> Our Samba file server seems to have a memory leakage. We are using samba > as file server out of the box (debian sarge) on kernel 2.6.16.31. > After a while users who have some shares and files open are acquiring > more and more memory until the smbd dies.A wild guess is that this might be printer related instead of file related.> Here is a small shortcut from top: > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND > 13843 gxxxxx 16 0 51792 44m 2552 S 0.3 17.8 0:22.97 smbd > 13840 bxxxxx 17 0 31400 25m 2764 S 0.7 10.0 2:42.78 smbd > smbd is allocation and more memory. We are using user security and > smbpasswd as password backend.Ok, 44M is a lot but not entirely out of scope, depending on what your clients do. But it's very likely a memleak, true.> The output from 'smbcontrol 13843 pool-usage' shows: > global talloc allocations in pid: 13843 > name chunks bytes > ---------------------------------------- -------- -------- > msg_pool_usage 1 159 > lp_talloc 2 2 > connection_struct 1 1844 > pipe spoolss 0x922dfb0 0 0 > pipe spoolss 0x83f4380 0 0 > connection_struct 1 1844 > connection_struct 1 1844 > passdb internal SAM_ACCOUNT allocation 19 493 > passdb internal SAM_ACCOUNT allocation 17 503 > pdb_context internal allocation context 5 1513 > passdb internal SAM_ACCOUNT allocation 8 397 > ---------------------------------------- -------- -------- > TOTAL 55 8599Ok, this looks innocent. So we have a problem out of the talloc memory space. How deep do you want to go? :-) I would do several steps: First, try with 3.0.23d. Second, recompile with -g and run smbd under valgrind --tool=memcheck. Be aware that valgrind makes smbd at least 10 times slower, so this is something for a non-productive server. Then get some smbd to chew that memory, and shut it down by disconnecting from the client or sending it the shutdown command. valgrind will then show you the blocks allocated and not freed, so we will at least see the allocation places that leak. Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.samba.org/archive/samba/attachments/20061117/21902011/attachment.bin
after the several command, I get the following result: top - 19:50:15 up 135 days, 9:48, 2 users, load average: 0.16, 0.09, 0.03 Tasks: 91 total, 1 running, 90 sleeping, 0 stopped, 0 zombie Cpu(s): 0.2% us, 0.2% sy, 0.0% ni, 99.1% id, 0.5% wa, 0.0% hi, 0.0% si Mem: 1036052k total, 1030300k used, 5752k free, 130232k buffers Swap: 2000052k total, 8564k used, 1991488k free, 736512k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 14805 root 16 0 13380 7204 9980 S 0.0 0.7 0:01.41 /usr/sbin/smbd -D 14738 root 16 0 12848 6900 9772 S 0.0 0.7 0:06.26 /usr/sbin/smbd -D 14146 root 16 0 12820 6772 9900 S 0.0 0.7 0:03.06 /usr/sbin/smbd -D 19788 root 16 0 12568 6648 9932 S 0.0 0.6 0:05.63 /usr/sbin/smbd -D 14138 root 16 0 12368 6592 9772 S 0.0 0.6 0:05.75 /usr/sbin/smbd -D 14068 root 16 0 12316 6436 9732 S 0.0 0.6 0:04.26 /usr/sbin/smbd -D 14212 root 16 0 12252 6416 9796 S 0.0 0.6 0:02.97 /usr/sbin/smbd -D 14149 root 16 0 12472 6360 9.8m S 0.0 0.6 0:02.79 /usr/sbin/smbd -D 14195 root 16 0 12096 6272 9900 S 0.0 0.6 0:14.85 /usr/sbin/smbd -D 14079 root 16 0 12252 6020 9.8m S 0.0 0.6 0:01.21 /usr/sbin/smbd -D 18951 root 16 0 12080 6012 9996 S 0.0 0.6 0:01.53 /usr/sbin/smbd -D 14680 root 16 0 12128 6008 9864 S 0.0 0.6 0:02.56 /usr/sbin/smbd -D 14740 root 16 0 12020 5976 9900 S 0.0 0.6 0:01.67 /usr/sbin/smbd -D 16483 root 16 0 11828 5828 9784 S 0.0 0.6 0:00.18 /usr/sbin/smbd -D 13159 root 16 0 12100 5744 9884 S 0.0 0.6 0:00.34 /usr/sbin/smbd -D 15555 root 16 0 11800 5424 9872 S 0.0 0.5 0:00.41 /usr/sbin/smbd -D 19150 root 16 0 11720 5388 9908 S 0.0 0.5 0:00.16 /usr/sbin/smbd -D 20030 root 16 0 11548 5312 9736 S 0.0 0.5 0:00.33 /usr/sbin/smbd -D 13928 root 16 0 11496 5276 9688 S 0.0 0.5 0:01.60 /usr/sbin/smbd -D 13876 root 16 0 11572 5256 9672 S 0.0 0.5 0:01.60 /usr/sbin/smbd -D 18284 root 16 0 11532 5224 9720 S 0.0 0.5 0:00.47 /usr/sbin/smbd -D 13614 root 16 0 11656 5212 9736 S 0.0 0.5 0:00.43 /usr/sbin/smbd -D 13618 root 16 0 11652 5188 9732 S 0.0 0.5 0:00.36 /usr/sbin/smbd -D 19086 root 16 0 11516 5152 9704 S 0.0 0.5 0:00.17 /usr/sbin/smbd -D 13572 root 16 0 11468 5028 9660 S 0.0 0.5 0:00.06 /usr/sbin/smbd -D 13622 root 16 0 11484 4968 9676 S 0.0 0.5 0:00.09 /usr/sbin/smbd -D 13361 root 16 0 11460 4900 9652 S 0.0 0.5 0:00.23 /usr/sbin/smbd -D 20515 root 19 0 439m 4840 367m S 0.0 0.5 0:00.00 /usr/sbin/slapd 9292 root 15 0 11492 4600 9620 S 0.0 0.4 1:10.44 /usr/sbin/smbd -D 9291 root 16 0 11176 4348 9496 S 0.0 0.4 0:00.93 /usr/sbin/smbd -D 2792 root -2 0 4292 4260 2052 S 0.0 0.4 12:10.93 heartbeat: heartbeat: master control process 18155 bind 25 0 34124 4140 7368 S 0.0 0.4 0:00.00 /usr/sbin/named -u bind -t /var/lib/named 12896 root 16 0 7308 4084 3528 S 0.0 0.4 0:43.80 /usr/sbin/cupsd -F 29430 root 16 0 3264 3264 2788 S 0.0 0.3 0:00.12 /usr/sbin/ntpd -p /var/run/ntpd.pid 22100 root 16 0 17768 2680 8116 S 0.0 0.3 0:00.07 sshd: root@pts/0 22159 root 16 0 16744 2668 8116 S 0.0 0.3 0:00.02 sshd: root@pts/1 2902 nobody -2 0 2520 2520 2052 S 0.0 0.2 0:00.00 heartbeat: heartbeat: FIFO reader 2903 nobody -2 0 2516 2516 2052 S 0.0 0.2 0:00.29 heartbeat: heartbeat: write: bcast eth1 2904 nobody -2 0 2516 2516 2052 S 0.0 0.2 3:03.17 heartbeat: heartbeat: read: bcast eth1 22117 root 16 0 6504 2512 6044 S 0.3 0.2 0:00.57 top 22168 root 16 0 6500 2508 6044 R 0.3 0.2 0:00.23 top 21555 postfix 17 0 6476 2404 6048 S 0.0 0.2 0:00.00 pickup -l -t fifo -u -c 9289 root 15 0 6020 2096 4996 S 0.0 0.2 0:03.22 /usr/sbin/nmbd -D 20201 postfix 16 0 6508 1660 6080 S 0.0 0.2 0:00.05 qmgr -l -t fifo -u -c 22104 root 15 0 3064 1648 2708 S 0.0 0.2 0:00.01 -bash 22162 root 15 0 3060 1644 2708 S 0.0 0.2 0:00.00 -bash I think that is normal that several smbd have been launched but the memory utilization seems to be correct. but I have already 99% physical mem used. Any ideas? THanks, Mike ----- Original Message ----- From: James Zuelow <James_Zuelow@ci.juneau.ak.us> To: it@ramadaparkhotel.ch Sent: lundi 20 novembre 2006 18 h 26 GMT+0100 Europe/Berlin Subject: RE: Re: Re: [Samba] Samba 3.0.14 (Debian Sarge) Memory Leakage samba-bounces+james_zuelow=ci.juneau.ak.us@lists.samba.org wrote:> i have a question about memory. > When I launched the "top" command, I can see the following: > top - 16:08:47 up 135 days, 6:07, 1 user, load average: > 0.00, 0.00, 0.00 > Tasks: 96 total, 1 running, 95 sleeping, 0 stopped, 0 zombie > Cpu(s): 0.3% us, 0.0% sy, 0.0% ni, 99.1% id, 0.5% wa, > 0.0% hi, 0.0% si > Mem: 1036052k total, 1028580k used, 7472k free, 123376k buffers > Swap: 2000052k total, 8564k used, 1991488k free, 734732k cached > > 99% of my memory is used but It is impossible to see what > proccess take > the amount of the memory when I see "%MEM" column >Try starting top, press M (sorts by memory) H (turns on threads, so you'll see multiple copies of daemons) and c (shows the command line). You might want to do this in an x terminal where you have lots of real estate to see the command line. Does that help? James Zuelow....................CBJ MIS (907)586-0236 Network Specialist...Registered Linux User No. 186591
On Mon, Nov 20, 2006 at 07:55:14PM +0100, it wrote:> I think that is normal that several smbd have been > launched but the memory utilization seems to be correct. > but I have already 99% physical mem used. > > Any ideas?Yes. From that view your system looks perfectly healthy. Unused memory is bad memory, Linux uses all available memory for various caches. Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.samba.org/archive/samba/attachments/20061120/a8ae38b5/attachment.bin
On 11/20/06, it <mmortier@ramadaparkhotel.ch> wrote:> > after the several command, I get the following result: > top - 19:50:15 up 135 days, 9:48, 2 users, load average: 0.16, 0.09, > 0.03 > Tasks: 91 total, 1 running, 90 sleeping, 0 stopped, 0 zombie > Cpu(s): 0.2% us, 0.2% sy, 0.0% ni, 99.1% id, 0.5% wa, 0.0% hi, 0.0%si > Mem: 1036052k total, 1030300k used, 5752k free, 130232k buffers > Swap: 2000052k total, 8564k used, 1991488k free, 736512k cached > > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND > 14805 root 16 0 13380 7204 9980 S 0.0 0.7 0:01.41/usr/sbin/smbd -D > 14738 root 16 0 12848 6900 9772 S 0.0 0.7 0:06.26/usr/sbin/smbd -D > 14146 root 16 0 12820 6772 9900 S 0.0 0.7 0:03.06/usr/sbin/smbd -D > 19788 root 16 0 12568 6648 9932 S 0.0 0.6 0:05.63/usr/sbin/smbd -D > 14138 root 16 0 12368 6592 9772 S 0.0 0.6 0:05.75/usr/sbin/smbd -D > 14068 root 16 0 12316 6436 9732 S 0.0 0.6 0:04.26/usr/sbin/smbd -D > 14212 root 16 0 12252 6416 9796 S 0.0 0.6 0:02.97/usr/sbin/smbd -D > 14149 root 16 0 12472 6360 9.8m S 0.0 0.6 0:02.79/usr/sbin/smbd -D > 14195 root 16 0 12096 6272 9900 S 0.0 0.6 0:14.85/usr/sbin/smbd -D > 14079 root 16 0 12252 6020 9.8m S 0.0 0.6 0:01.21/usr/sbin/smbd -D > 18951 root 16 0 12080 6012 9996 S 0.0 0.6 0:01.53/usr/sbin/smbd -D > 14680 root 16 0 12128 6008 9864 S 0.0 0.6 0:02.56/usr/sbin/smbd -D > 14740 root 16 0 12020 5976 9900 S 0.0 0.6 0:01.67/usr/sbin/smbd -D > 16483 root 16 0 11828 5828 9784 S 0.0 0.6 0:00.18/usr/sbin/smbd -D > 13159 root 16 0 12100 5744 9884 S 0.0 0.6 0:00.34/usr/sbin/smbd -D > 15555 root 16 0 11800 5424 9872 S 0.0 0.5 0:00.41/usr/sbin/smbd -D > 19150 root 16 0 11720 5388 9908 S 0.0 0.5 0:00.16/usr/sbin/smbd -D > 20030 root 16 0 11548 5312 9736 S 0.0 0.5 0:00.33/usr/sbin/smbd -D > 13928 root 16 0 11496 5276 9688 S 0.0 0.5 0:01.60/usr/sbin/smbd -D > 13876 root 16 0 11572 5256 9672 S 0.0 0.5 0:01.60/usr/sbin/smbd -D > 18284 root 16 0 11532 5224 9720 S 0.0 0.5 0:00.47/usr/sbin/smbd -D > 13614 root 16 0 11656 5212 9736 S 0.0 0.5 0:00.43/usr/sbin/smbd -D > 13618 root 16 0 11652 5188 9732 S 0.0 0.5 0:00.36/usr/sbin/smbd -D > 19086 root 16 0 11516 5152 9704 S 0.0 0.5 0:00.17/usr/sbin/smbd -D > 13572 root 16 0 11468 5028 9660 S 0.0 0.5 0:00.06/usr/sbin/smbd -D > 13622 root 16 0 11484 4968 9676 S 0.0 0.5 0:00.09/usr/sbin/smbd -D > 13361 root 16 0 11460 4900 9652 S 0.0 0.5 0:00.23/usr/sbin/smbd -D > 20515 root 19 0 439m 4840 367m S 0.0 0.5 0:00.00/usr/sbin/slapd > 9292 root 15 0 11492 4600 9620 S 0.0 0.4 1:10.44 /usr/sbin/smbd > -D > 9291 root 16 0 11176 4348 9496 S 0.0 0.4 0:00.93 /usr/sbin/smbd > -D > 2792 root -2 0 4292 4260 2052 S 0.0 0.4 12:10.93 heartbeat: > heartbeat: master control process > 18155 bind 25 0 34124 4140 7368 S 0.0 0.4 0:00.00/usr/sbin/named -u bind -t /var/lib/named > 12896 root 16 0 7308 4084 3528 S 0.0 0.4 0:43.80/usr/sbin/cupsd -F > 29430 root 16 0 3264 3264 2788 S 0.0 0.3 0:00.12/usr/sbin/ntpd -p /var/run/ntpd.pid > 22100 root 16 0 17768 2680 8116 S 0.0 0.3 0:00.07 sshd: > root@pts/0 > 22159 root 16 0 16744 2668 8116 S 0.0 0.3 0:00.02 sshd: > root@pts/1 > 2902 nobody -2 0 2520 2520 2052 S 0.0 0.2 0:00.00 heartbeat: > heartbeat: FIFO reader > 2903 nobody -2 0 2516 2516 2052 S 0.0 0.2 0:00.29 heartbeat: > heartbeat: write: bcast eth1 > 2904 nobody -2 0 2516 2516 2052 S 0.0 0.2 3:03.17 heartbeat: > heartbeat: read: bcast eth1 > 22117 root 16 0 6504 2512 6044 S 0.3 0.2 0:00.57 top > 22168 root 16 0 6500 2508 6044 R 0.3 0.2 0:00.23 top > 21555 postfix 17 0 6476 2404 6048 S 0.0 0.2 0:00.00 pickup -l -t > fifo -u -c > 9289 root 15 0 6020 2096 4996 S 0.0 0.2 0:03.22 /usr/sbin/nmbd > -D > 20201 postfix 16 0 6508 1660 6080 S 0.0 0.2 0:00.05 qmgr -l -t > fifo -u -c > 22104 root 15 0 3064 1648 2708 S 0.0 0.2 0:00.01 -bash > 22162 root 15 0 3060 1644 2708 S 0.0 0.2 0:00.00 -bash > > I think that is normal that several smbd have been launched but the memory > utilization > seems to be correct. > but I have already 99% physical mem used. > > Any ideas?Having 99% of the memory used is absolutely normal in linux no matter how much memory your apps use or how much memory you have in the system. The memory that is not in use by applications for is used for disk cache and will be made available when your applications need it. John