Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 246152 - mplayer eats memory and hangs
Summary: mplayer eats memory and hangs
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-09 12:34 UTC by Marcus Hähnel
Modified: 2009-08-03 18:57 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Hähnel 2008-11-09 12:34:01 UTC
long problem description here:
http://forums.gentoo.org/viewtopic-p-5274462.html

MPlayer starts to waste memory at 1-2MB/s when playing MPEG2 video, fewer with XVid. Install is fresh ~x86 (the same results happened on ~amd64 before. I reinstalled to ensure I have a clean install). The memory is not assigned to mplayer but seems to be "cached" memory (at least partially). It is not freed on mplayer exit.

The real problem is, that mplayer (and the whole system! even remote shells) hang when the memory is freed again (what it is automatically after an arbitary amount of time).

The player is practically unusable. Same results happen with mythtv.
It does not happen with xine however and the effect does not appear when -vo null is selected.

The codec pack used is ffmpeg (seemingly).

I currently run under 2.6.26-r2 but exactly the same happens with 2.6.27-r2 (i just switched to test if it is the kernels fault)

Information:
===============
emerge --info
Portage 2.2_rc13 (default/linux/x86/2008.0, gcc-4.3.2, glibc-2.8_p20080602-r0, 2.6.26-gentoo-r2 i686)
=================================================================
System uname: Linux-2.6.26-gentoo-r2-i686-AMD_Sempron-tm-_Processor_LE-1150-with-glibc2.0
Timestamp of tree: Sat, 08 Nov 2008 09:00:02 +0000
app-shells/bash:     3.2_p39
dev-lang/python:     2.4.4-r13, 2.5.2-r8
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.3.0-r1
sys-apps/sandbox:    1.2.18.1-r3
sys-devel/autoconf:  2.63
sys-devel/automake:  1.9.6-r2, 1.10.1-r1
sys-devel/binutils:  2.19
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=athlon-xp -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/terminfo /etc/udev/rules.d"
CXXFLAGS=""
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LDFLAGS="-Wl,-O1"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X acl alsa berkdb bzip2 cli cracklib crypt cups dri dvd fftw fortran gdbm gpm iconv ipv6 isdnlog midi mmx mmxext mudflap mysql ncurses nls nptl nptlonly opengl openmp pam pcre perl pppd python readline reflection session spl sse sse2 ssl sysfs tcpd unicode v4l v4l2 win32codecs x264 x86 xorg xvid zeroconf zlib zvbi" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="fglrx radeonhd"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

---------------------

emerge -pv ffmpeg mplayer

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ] media-video/ffmpeg-0.4.9_p20081014  USE="X ipv6 mmx mmxext v4l v4l2 x264 xvid zlib -aac (-altivec) -amr -bindist -debug -dirac -doc -encode -gsm -hardcoded-tables -ieee1394 -mp3 -network -schroedinger -sdl -ssse3 -test -theora -threads -vhook -vorbis" 0 kB
[ebuild   R   ] media-video/mplayer-1.0_rc2_p27725-r1  USE="3dnow 3dnowext X a52 alsa dvd iconv ipv6 mad mmx mmxext mp3 opengl sse sse2 theora truetype unicode v4l v4l2 vorbis win32codecs x264 xscreensaver xv xvid -aac -aalib (-altivec) -amrnb -amrwb -arts -bidi -bindist -bl -cddb -cdio -cdparanoia -cpudetection -custom-cflags -custom-cpuopts -debug -dga -dirac -directfb -doc -dts -dv -dvb -dxr3 -enca -encode -esd -fbcon -ftp -ggi -gif -gtk -jack -joystick -jpeg -ladspa -libcaca -lirc -live -lzo -md5sum -mp2 -musepack -nas -nemesi -openal -oss -png -pnm -pulseaudio -pvr -quicktime -radio -rar (-real) -rtc -samba -schroedinger -sdl -speex -srt -ssse3 -svga -teletext -tga -vidix -xanim -xinerama -xvmc -zoran" VIDEO_CARDS="-mga -s3virge -tdfx -vesa" 0 kB

Total: 2 packages (2 reinstalls), Size of downloads: 0 kB

-----------------------
cat /proc/cpuinfo 
processor	: 0
vendor_id	: AuthenticAMD
cpu family	: 15
model		: 127
model name	: AMD Sempron(tm) Processor LE-1150
stepping	: 1
cpu MHz		: 2000.151
cache size	: 256 KB
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 1
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow pni cx16 lahf_lm extapic cr8_legacy 3dnowprefetch
bogomips	: 4002.85
clflush size	: 64
power management: ts fid vid ttp tm stc 100mhzsteps

---------------------------

valgrind is NOT usable. memcheck loads my system with 95% making any videorendering impossible and causing mplayer to spit out tons of warning messages. I doubt the error is reproducible under these conditions.
Comment 1 Luca Barbato gentoo-dev 2008-11-09 15:34:52 UTC
which vo are you using?
Comment 2 Marcus Hähnel 2008-11-09 15:47:39 UTC
I can not use gl output since this is not supported by my chipset (Radeon 3100 integrated graphics)... but I could install the older fglrx / xorg-server (8.542 / 1.4.2) combo and try again with this. But this combination did not make a difference with the x11/xv output devices.

I tried xv and x11 but this didn't seem to make a difference. They both lead to memory eating. Xover does not output anything.
Comment 3 Luca Barbato gentoo-dev 2008-11-09 15:56:36 UTC
vo sdl or another player (e.g ffplay or vlc) show the same behaviour?
Comment 4 Marcus Hähnel 2008-11-09 17:03:30 UTC
-vo sdl is not possible since it is not compiled with sdl support. should i recompile?

VLC is also not installed.
Xine (installed) does NOT show the behaviour when playing the raw stream via
cat /dev/video0 | xine stdin://mpeg2

but it shows when playing a MPEG2 file.

i have never heard of ffplay. What package does it belong to?
Comment 5 Peter Alfredsen (RETIRED) gentoo-dev 2008-11-09 17:42:11 UTC
(In reply to comment #4)

> Xine (installed) does NOT show the behaviour when playing the raw stream via
> cat /dev/video0 | xine stdin://mpeg2
> 
> but it shows when playing a MPEG2 file.

It sounds to me like what you're complaining about is not so much ffmpeg behaviour but linux behaviour. Linux will cache whatever you read in the unused parts of your memory. Try to start a video in one terminal and foreground the video, then in another execute this command:
watch -n .1 free -b
If the part that is going up with 1-2Mb/s is the buffers/cached part, then this is expected behaviour. The question then becomes why your system is loaded so much when trying to flush the cache.
Comment 6 Marcus Hähnel 2008-11-09 18:06:48 UTC
you are right. 

It IS the cache that goes up. NOT the +/- buffers/cache but the last column.
Do you have any idea how I can diagnose what causes the load to the system and the hanging?
Comment 7 Luca Barbato gentoo-dev 2008-11-09 18:19:02 UTC
try memtest, maybe it's an hardware issue.
Comment 8 Marcus Hähnel 2008-11-10 10:24:26 UTC
i had memtest running all night. However it turned up no errors in the memory.

The problem with the hangs while freeing memory perisists...

Is there any way to disable the disc caching in Linux?
Comment 9 Samuli Suominen (RETIRED) gentoo-dev 2009-08-03 18:57:23 UTC
Try 20090731 snapshot and up-to-date system. Reopen if this is still a issue.