Hi everybody,
The problem is : my system stops working after running hundreds of web pages which contains flash.
The system used is a linux custom system, based on LFS 6.2, kernel 2.6.16.27 with firefox 2.0.0.5. The hardware used is a 3.5" motherboard with a 1.6G celeron M, 512M RAM and the system is run from a compact flash. Thus we decided not to have any swap partition.
I have a basic script which plays a loop of 2 contents : it plays a web page for 10 seconds with firefox, then firefox is killed, then it plays a movie for 10 seconds with mplayer, then mplayer is killed.
If the web page does not contain any flash content, it works well. When looking at top, we can see that the memory used and the memory containing cache remain constant. Here is an output from top :
top - 10:27:22 up 2 days, 16:56, 1 user, load average: 0.23, 0.33, 0.42
Tasks: 30 total, 3 running, 27 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0% us, 0.0% sy, 21.6% ni, 78.4% id, 0.0% wa, 0.0% hi, 0.0% si
Mem: 484024k total, 189728k used, 294296k free, 5736k buffers
Swap: 0k total, 0k used, 0k free, 98936k cached
But if I play a web page containing a flash element, for example a 1M flash web page, after half an hour the system is not usable, I have just a black screen, and nothing is played anymore... When looking at top, we can see the whole memory is used, whereas we just kept on playing the same 2 elements, the cache memory is full, and the cpu is 100% waiting for i/o... Here is an output from top :
top - 10:29:56 up 42 min, 1 user, load average: 3.21, 2.85, 1.67
Tasks: 46 total, 1 running, 45 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.6% us, 0.0% sy, 0.0% ni, 0.0% id, 98.4% wa, 0.0% hi, 0.0% si
Mem: 484024k total, 478548k used, 5476k free, 204k buffers
Swap: 0k total, 0k used, 0k free, 401984k cached
I read here that it was not a good idea to run a linux system without swap, so I tried using a swap partition. But either the partition is on the CF (not a good idea but I had to test it), or in memory, I didn't notice any improvement... It just worked a few minutes more, but as soon as the swap file was full, the problem appeared.
My question is : what can I do ??? I suspect this is a flash plugin problem, a memory leak... But why doesn't Firefox release the memory when I kill it ??? How can I solve this problem ?
Any help would be really appreciated !!!
Thanks,
Olivier
what processes are running
i am used to look at 'top' for the list of running processes as well, not just the summary.
the flash plugin may run as a separate process, not inside firefox. if this is the case, the plugin happily continues to run, and after several loops, the plugins accumulate. have you looked at your user's process list? not just the processes eating most cpu: as you say, the processes mainly cause i/o, not cpu load, and will not stay at top's top.
firefox only uses hardware through the X server. when firefox gets killed, the resources allocated by the X server on behalf of firefox should be freed as well, but you could monitor the X server for strange behaviour. there is a nice utility 'xrestop' to show you the X clients and their resource allocation.
Ok. Here is the entire
Ok. Here is the entire output of top :
top - 13:01:27 up 3:13, 1 user, load average: 2.49, 1.39, 0.55
Tasks: 31 total, 1 running, 30 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0% us, 1.5% sy, 5.0% ni, 0.0% id, 93.3% wa, 0.3% hi, 0.0% si
Mem: 484024k total, 471540k used, 12484k free, 156k buffers
Swap: 0k total, 0k used, 0k free, 405448k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
24332 videospo 26 10 81924 16m 11m D 6.3 3.6 0:00.23 firefox-bin
15298 root 26 10 6296 560 212 D 0.3 0.1 0:01.02 sshd
1 root 16 0 1508 124 60 S 0.0 0.0 0:00.73 init
2 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
3 root 10 -5 0 0 0 S 0.0 0.0 0:00.02 events/0
4 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 khelper
5 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
7 root 10 -5 0 0 0 S 0.0 0.0 0:00.15 kblockd/0
8 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid
88 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khubd
143 root 15 0 0 0 0 S 0.0 0.0 0:00.02 pdflush
144 root 15 0 0 0 0 S 0.0 0.0 0:00.01 pdflush
146 root 18 -5 0 0 0 S 0.0 0.0 0:00.00 aio/0
145 root 15 0 0 0 0 S 0.0 0.0 0:01.27 kswapd0
226 root 11 -5 0 0 0 S 0.0 0.0 0:00.02 kseriod
301 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kpsmoused
428 root 13 -4 1584 152 0 S 0.0 0.0 0:00.04 udevd
957 root 26 10 1652 276 168 S 0.0 0.1 0:00.27 syslogd
964 root 26 10 2364 956 0 S 0.0 0.2 0:00.04 klogd
1095 root 26 10 3580 272 0 S 0.0 0.1 0:00.18 sshd
1542 videospo 16 0 2516 120 0 S 0.0 0.0 0:00.00 xinit
1544 root 15 0 188m 6468 1204 S 0.0 1.3 0:25.19 X
1801 videospo 17 0 4648 192 0 S 0.0 0.0 0:00.00 wmaker
1802 videospo 15 0 5956 1460 580 S 0.0 0.3 0:02.27 wmaker
15520 root 25 10 4780 1040 652 S 0.0 0.2 0:00.15 bash
24156 root 27 10 4596 1124 840 S 0.0 0.2 0:00.03 fire.sh
24318 videospo 29 10 4860 1328 1036 S 0.0 0.3 0:00.00 bash
24319 videospo 32 10 4992 1432 1116 S 0.0 0.3 0:00.00 firefox
24320 root 26 10 3548 456 400 S 0.0 0.1 0:00.00 sleep
24325 videospo 35 10 4988 1432 1096 S 0.0 0.3 0:00.00 run-mozilla.sh
24333 root 26 10 2028 988 792 R 0.0 0.2 0:00.00 top
The processes are run by the user videospot. I have no flash process running, as we can see in ps output :
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 1508 120 ? S 09:47 0:00 init [3]
root 2 0.0 0.0 0 0 ? SN 09:47 0:00 [ksoftirqd/0]
root 3 0.0 0.0 0 0 ? S< 09:47 0:00 [events/0]
root 4 0.0 0.0 0 0 ? S< 09:47 0:00 [khelper]
root 5 0.0 0.0 0 0 ? S< 09:47 0:00 [kthread]
root 7 0.0 0.0 0 0 ? S< 09:47 0:00 [kblockd/0]
root 8 0.0 0.0 0 0 ? S< 09:47 0:00 [kacpid]
root 88 0.0 0.0 0 0 ? S< 09:47 0:00 [khubd]
root 143 0.0 0.0 0 0 ? S 09:47 0:00 [pdflush]
root 144 0.0 0.0 0 0 ? S 09:47 0:00 [pdflush]
root 146 0.0 0.0 0 0 ? S< 09:47 0:00 [aio/0]
root 145 0.0 0.0 0 0 ? S 09:47 0:01 [kswapd0]
root 226 0.0 0.0 0 0 ? S< 09:47 0:00 [kseriod]
root 301 0.0 0.0 0 0 ? S< 09:47 0:00 [kpsmoused]
root 428 0.0 0.0 1584 152 ? S /dev/null 2>&1
root 24871 0.0 0.0 3548 456 pts/0 SN 13:04 0:00 sleep 5
69 24872 6.8 2.2 24500 10948 pts/0 SN 13:04 0:00 mplayer /storage/data/mov/328
root 24873 0.0 0.1 4040 848 pts/0 RN+ 13:04 0:00 ps aux
When this happens, I feel like the kernel has trashed the apps code which was previously in memory, and try to reload it from the compact flash, which could be an explanation for these hard iowaits...
Killing X does not release the memory either... When I restart it and run firefox it iowaits again...
But why doesn't Firefox
The most important question is: which video drivers are you using? It is plausible that a buggy graphics driver might not be properly releasing resources allocated by Flash.
If you're using proprietary drivers, try running the same thing with open source ones, or vice versa. If that doesn't change anything, or if you don't have a choice, you can try the standard VESA interface too.
The graphic chipset is an
The graphic chipset is an Intel 852GME/GM. The driver used is the xf86-video-intel-2.0.0, loaded by a xorg-server-1.3.0.0.
I don't think this is a graphics issue / Xorg issue, as the problem also appeared with our last hardware, which was an asrock motherboard with SiS graphics, and an XFree86 server.
memory problem with flash and firefox
as far as i can see the tempory files are being stored so maybe if you make a small program to delete the files if they are not being used after a certin amount of time, or try increseing the size of the file where the files are stored.
This is not a problem of
This is not a problem of temporary files. I already deletes any temp file which could be created..
It seems to be a flash problem
I just tried the same test with opera. I have exactly the same behaviour : system slow down, nothing happens, cpu is full on iowait, and then suddenly processes get trashed, the X server and the browser are killed... I really don't know what to do with such an issue... Is the flash library coded so bad that it completely mess up with the linux memory management ??? I can't believe it...
Need to try latest flash plugin
It is a "beta" version, from 'labs.adobe.com' and is one month newer than the released version. With this coder, it seems the newest code is usually the best, even if labelled 'alpha', 'beta', etc., since his so-called 'release' code for Linux has security popups that do nothing and a control panel that does nothing, although the latest beta versions act more like they might do something.
As for your question, "Is the flash library coded so bad ...", the answer is probably yes, in the race to the bottom (coders), we are almost there.
The latest plugin seems to correct this issue !
You're right ! I tried the beta revision from labs.adobe.com yesterday, and this morning the memory use is still the same and I have no problem of iowaits so far... Great :) Thank you all for your help, it really was only a flash issue !
Is there anything in
Is there anything in /dev/shm after this happens? Also, comparing the differences in 'lsof' before and after running Firefox/Flash might be revealing.