Bug 8982 - High memory usage when file copied
Summary: High memory usage when file copied
Status: RESOLVED WORKSFORME
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.6.5
Hardware: Other Linux
: P5 major
Target Milestone: ---
Assignee: Volker Lendecke
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-06 14:43 UTC by samba
Modified: 2012-06-19 12:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description samba 2012-06-06 14:43:21 UTC
-- DESCRIPTION --
When a file is copied to a share, RAM usage is vastly increased. After the file is copied, the RAM is not cleared. When the file is deleted, RAM gets freed.

-- STEPS TO REPRODUCE --
1) Copy a big file (say, 200M) to a share
2) Observe vastly increased RAM usage

-- CONFIGURATION --
http://pastebin.com/e5bz4gB1

-- SCREENSHOTS --
Initial state: http://storage1.static.itmages.ru/i/12/0606/h_1338993271_8994384_3ac670a82e.png
File copied: http://storage3.static.itmages.ru/i/12/0606/h_1338993354_2045405_1adb05b18a.png
File removed: http://storage5.static.itmages.ru/i/12/0606/h_1338993369_5787834_adb2e1bb6c.png

-- SYSTEM INFO --
NETGEAR WNDR3800 ar71xx mips_r2
OpenWrt Attidute Adjustment r32055
Linux kernel 3.3.8
Samba 3.6.5-2
Comment 1 Volker Lendecke 2012-06-06 14:50:33 UTC
RSS for smbd while the copy happens is still at roughly 1.5MB, which is not much. This is all samba can control. I would guess this is buffer cache. Please send the output of the "free" command to make sure this is the case.
Comment 2 samba 2012-06-06 14:57:47 UTC
Here is the output of "free" after the file was copied:

             total         used         free       shared      buffers
Mem:        126968       124316         2652            0         5336
-/+ buffers:             118980         7988
Swap:       600060            0       600060



And after the file was deleted:

             total         used         free       shared      buffers
Mem:        126968        31428        95540            0         5344
-/+ buffers:              26084       100884
Swap:       600060            0       600060
Comment 3 Volker Lendecke 2012-06-06 15:00:27 UTC
Then it is another command in user space taking the memory. The smbd that is shown in the "file being copied" screenshot is not that one.

Please send the output of 

ps uax

while memory usage is high
Comment 4 samba 2012-06-06 15:11:44 UTC
Busybox has a limited ps, there are no 'a', 'u' and 'x' options. This is the only I could get: http://pastebin.com/cBjpcy3h

If this is not enough, I'll try to find a full 'ps' binary or build one.
Comment 5 Volker Lendecke 2012-06-06 15:16:38 UTC
Well, without further diagnosis you will not be able to fix it. "free" reports high memory use, but the system does not give you more information. So you are stuck. Please contact your vendor for more information.
Comment 6 samba 2012-06-06 15:27:26 UTC
This has something to do with cache. Maybe there's a column in htop that will show what program uses it?
Comment 7 Volker Lendecke 2012-06-19 12:14:55 UTC
Closing as "WORKSFORME". I don't see any high memory use in the information provided that smbd can directly influence. If the kernel sits on memory, there is nothing smbd can do about this.