Tiny Core Linux

Tiny Core Base => TCB Bugs => Topic started by: Kenavru on January 04, 2012, 03:33:56 PM

Title: TC 4.2 + Samba - RAM usage & CPU stall
Post by: Kenavru on January 04, 2012, 03:33:56 PM
Hi,
I'm using TC on thin client Igel2110 (x86 VIA C7 & CN700 ) with 256/512 MB of RAM and 128MB CF - as a NAS server.
Previously I had Debian 8.0.3 - Worked fine but it was too large & had tooo long BootUP.

Now on TC4.2 I have strange problem with Samba3 & LAN transfer - It works but every transfered MB stays in RAM in process (/usr/local/sbin/smbd -D)
Quote
Mem: 240588K used, 3728K free, 0K shrd, 3264K buff, 218448K cached
CPU0:  1.7% usr 13.0% sys  0.0% nic 81.0% idle  0.0% io  0.0% irq  4.1% sirq
Load average: 0.15 0.06 0.05 2/55 853
  PID  PPID USER     STAT   VSZ %VSZ CPU %CPU COMMAND
  849   811 nobody   S    10792  4.4   0 12.0 /usr/local/sbin/smbd -D
and when amout of free RAM drops to ~4MB I receive (or NOT - just system freeze)
Quote
INFO: rcu_sched_state detected stall on CPU
& PC is not responsive ...

What to do ?
How to disable this data caching ?

I have no SWAP partition - TC creates by def. RAMdisk and mounts it as swap.
PC is connected to USB HDD 1TB Ext4.
There is nothin else installed - just core & samba3

ps. Sorry for my english  - its not my native language :)
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: gerald_clark on January 04, 2012, 03:48:56 PM
http://www.linuxatemyram.com/ (http://www.linuxatemyram.com/)
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: Kenavru on January 04, 2012, 03:54:53 PM
I know that ;)
but its not fine ;)
I cannot transfer via LAN file/files larger than my RAM becouse system freeze :)
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: Rich on January 04, 2012, 03:59:47 PM
Hi Kenavru
Most of the Tinycore directory structure resides in RAM. It sounds like you mapped your share into
RAM. What is the path you told Samba to share?
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: Kenavru on January 04, 2012, 04:21:33 PM
/mnt
Becouse I wonna share every pendrive/usbHDD that's pluged in :)
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: Rich on January 04, 2012, 04:28:00 PM
Hi Kenavru
If you save stuff to /mnt you are saving to RAM. If, for example, you save to /mnt/sdb1 AND you have
a pen drive mounted there, you will save to the pen drive.
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: Kenavru on January 04, 2012, 04:37:30 PM
ofc I'm saving only to mounted drive :)
But I have the same problem while I read data from disk, for example, watching shared Films on another PC on lan.
So it doesn't matter if I read or write ...

edit:
re-mounting drive makes RAM free ...
if I have 10MB before umount, after I have ~200MB.
While free ram <=4088kB - system freezes, cpu stall (I where watching ram using 'top' program while coping files)
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: Rich on January 04, 2012, 05:48:16 PM
Hi Kenavru
So you are sharing /mnt so that you an access all drives through one share point, correct?
If you set up your shares as /mnt/hda1, /mnt/sdc1, etc., do you still have memory problems?
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: Kenavru on January 04, 2012, 06:43:34 PM
Hi Kenavru
So you are sharing /mnt so that you an access all drives through one share point, correct?
correct :)
Quote
If you set up your shares as /mnt/hda1, /mnt/sdc1, etc., do you still have memory problems?
Yes, still the same problem - wherever I mount the drive / or set sharing dir. - there is no difference :(
I tried mounting with sync flag - no change ...
Linux eat's my RAM to the death :D
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: Rich on January 04, 2012, 08:24:32 PM
Hi Kenavru
What you are seeing is not normal behavior. I'm running a Samba server under TC2.1, Samba Ver. 3.4.5,
256Mb, Pentium MMX 233Mhz. This is what top displays on that machine as I download a 427Mb file
from it. Download time=100Secs.
Code: [Select]
Mem: 251748K used, 3764K free, 0K shrd, 1752K buff, 223104K cached
CPU: 12.9% usr 43.0% sys  0.0% nic  9.0% idle  0.0% io  5.5% irq 29.4% sirq
Load average: 0.49 0.12 0.04 2/70 10036
  PID  PPID USER     STAT   VSZ %MEM CPU %CPU COMMAND
 9630  1596 nobody   R     8796  3.4   0 88.4 /usr/local/sbin/smbd -D
   17     2 root     SW<      0  0.0   0  0.9 [kswapd0]
10016  1953 tc       R     2296  0.9   0  0.5 top
 1952  1550 root     S     2196  0.8   0  0.5 /usr/bin/dropbear -w -g -b /etc/dr
 6380  1596 root     S     9140  3.5   0  0.0 /usr/local/sbin/smbd -D
 1596     1 root     S     8724  3.4   0  0.0 /usr/local/sbin/smbd -D
 1605  1596 root     S     8724  3.4   0  0.0 /usr/local/sbin/smbd -D
 1588     1 root     S     4440  1.7   0  0.0 /usr/local/sbin/nmbd -D
 1574     1 root     S     4264  1.6   0  0.0 Xvesa -br -screen 1024x768x32 -sha
You might want to consider trying an older version of Tinycore. The 3.x series still use Samba 3.4.5.
It's possible the version of Samba (3.6.1) you are running is not as "memory friendly". Or it could be
the new kernel interacting badly with Samba.

Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: gerald_clark on January 04, 2012, 09:39:05 PM
Are you using a user space filesystem such as ntfs-3g?
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: Kenavru on January 05, 2012, 06:08:34 AM
nope, shared HDD has Ext4, CF card with OS -ext2.

I'm testing TC3.8.4 + samba3 3.4.5
Looks like everything works fine .. I already downloaded 10GB and works fine ...

 
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: Rich on January 05, 2012, 08:28:44 AM
Hi Kenavru
Glad to hear it's working.
Quote
Linux eat's my RAM to the death
The link gerald_clark provided is spot on. Linux tries to maximize the use of available system memory,
doling it out and swapping it as required. If an application keeps requesting memory without ever
freeing any, eventually the system will slow down and become sluggish, possibly even freezing.
I've noticed that Opera10 exhibits this behavior. Over time, it gets to a point where it consumes
90% of my 512Mb RAM, slowing my system down to a crawl, and I have to stop and restart it. This
type of behavior tends to be the exception and not the rule, as most apps are not that selfish.
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: Kenavru on January 05, 2012, 02:59:09 PM
Thanks for help :)
Looks like everything works fine now on TC 3.84
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: remus on January 14, 2012, 11:32:52 PM
I've done some testing on this issue.

TC 4.1 + Samba 3.4.5 - locks up tinycore on large file transfer

TC 4.1 + Samba 3.6.1 - locks up tinycore on large file transfer

TC 3.8.4 + Samba 3.4.5 - works fine
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: dormof on January 23, 2012, 11:35:25 AM
remus is right, I was configuring a trivial SAMBA based sharing, and almost broke my head revising the SAMBA documentation for this constant halting with TC 4.2.1 and SAMBA 3.6.1. I even resorted to put a hole 1 GB of RAM to the server machine, but it still went unresponsive after a few seconds!

On the other hand, and even downgrading to just 128 MB of RAM, TC 3.8.4 + SAMBA 3.4.5 allowed me to  transfer a 16 GB file from a Windows machine, without a hassle. Hope this gets a workaround for an upcoming 4.x release, either it's caused by SAMBA or the TC kernel. Anyways, thanks for the effort to everyone involved.
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: martin on January 23, 2012, 03:50:56 PM
I thought I would just pitch in and confirm that I am successfully running the latest samba3 in the repository on Core 4.2 and having no problems, regardless of file size. Reading from a mounted XFS partition.
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: curaga on January 24, 2012, 04:32:12 AM
I too had tried to test both Samba problems at once (this and the cifs mount one), by setting up two TC 4.2 VMs, one serving via samba3 and one reading with only filesystems- loaded.

I couldn't see either issue, both the server and client ran fine for me.

--

We have confirmation that the cifs client issue is fixed in 3.0.9, so perhaps the server issue too will be resolved in TC 4.4.
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: dormof on January 25, 2012, 04:31:25 AM
I thought I would just pitch in and confirm that I am successfully running the latest samba3 in the repository on Core 4.2 and having no problems, regardless of file size. Reading from a mounted XFS partition.
I too had tried to test both Samba problems at once (this and the cifs mount one), by setting up two TC 4.2 VMs, one serving via samba3 and one reading with only filesystems- loaded.

I couldn't see either issue, both the server and client ran fine for me.

--

We have confirmation that the cifs client issue is fixed in 3.0.9, so perhaps the server issue too will be resolved in TC 4.4.

Totally true. Just finished testing a >10 GB transfer with TC 4.2.1 + SAMBA 3.6.1 (updated on Jan 20), over several filesystems (xfs, ext3, ext4, reiserfs, ntfs) and it all worked like a charm.

I'd have to note that I had the samba3.tcz extension already downloaded by Jan 18, along with its dependencies -except samba3-libs- to have it ready for installation. Simply my bad, for what I was considering to stick with TC 3.8.4 meanwhile...

Oh, and my testing was succesful with only 96 MB of RAM.
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: Kenavru on January 27, 2012, 01:35:18 PM
TC 4.2.1 + SAMBA 3.6.1 = still the same bug
only 3.x.x works fine for me ;)
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: dormof on January 27, 2012, 03:18:07 PM
TC 4.2.1 + SAMBA 3.6.1 = still the same bug
only 3.x.x works fine for me ;)
I think it has something to do with the external 1 TB drive, for which TC 3 might have the most appropiate code to manage the USB interfacing, or something like that. I guess it might have an explanation from the experts in this regard, which I'm not one of.

Anyway, it's good to know there's at least a reliable option that lets you accomplish your NAS needs with the thin client. Hopefully the upcoming TC 4.x updates will fix the bug.
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: dacoon on May 08, 2012, 09:34:56 AM
Hi,

any news to this problem? I have the same issue, i think it have nothing to do with samba3. If I copy a big file form the external drive from on directory to another, also the ram get eaten and TC hang/freeze because it's running out of ram.

I think, it have to do only with mount on TC 4.2. I have this problem nearly 6 Month ago but get it fixed, but now after a backup crash (don't know how this could happen  :'( ) i had forgotten how. I think, because TC is loading with all directories into the RAM (usr/etc/mnt/bin ..), all mounting points also get redirected to this.

If i copy the file like "cp /mnt/sdb1/bigfile /mnt/sdb1/bigfile_new" and view with an other terminal "free -m" and "df | grep -v "loop"", written into a endless loop with "sleep 1". I see only how the ram is dropping but nothing on sdb1.
Title: Re: TC 4.2 + Samba - RAM usage & CPU stall
Post by: remus on May 08, 2012, 04:47:14 PM
The solution I found was to use

Microcore 3.8.4 + Samba 3.4.5 = Stable