Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 223825 - media-gfx/imagemagick-6.4.1.3 memory leak
Summary: media-gfx/imagemagick-6.4.1.3 memory leak
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Graphics Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-27 12:06 UTC by Andrej Filipcic
Modified: 2008-08-16 17:00 UTC (History)
3 users (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 Andrej Filipcic 2008-05-27 12:06:24 UTC
media-gfx/imagemagick-6.4.1.3 has a huge memory leak, when using perl module.
It starts leaking memory while loading the module, for example, running with perl debugger stops at:
Image::Magick::AUTOLOAD(/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/Image/Magick.pm:40):
40:         my $constname;
100 levels deep in subroutine calls!

media-gfx/imagemagick-6.4.0.6 works OK.

USE flags for imagemagick are USE="X bzip2 djvu doc graphviz jpeg jpeg2k lcms openexr perl png svg tiff truetype wmf xml zlib -fontconfig* -fpx -gs -hdri -jbig -nocxx -q32 -q8"
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2008-05-27 15:31:26 UTC
You forgot to include your emerge --info.
Comment 2 Andrej Filipcic 2008-05-27 18:30:28 UTC
Yes, here it is:
---------------
Portage 2.1.5.2 (default-linux/amd64/2007.0, gcc-4.2.4, glibc-2.7-r2, 2.6.25-gentoo-r1 x86_64)
=================================================================
System uname: 2.6.25-gentoo-r1 x86_64 Dual-Core AMD Opteron(tm) Processor 2218
Timestamp of tree: Tue, 27 May 2008 02:45:01 +0000
distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
ccache version 2.4 [disabled]
app-shells/bash:     3.2_p39
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.4.4-r13, 2.5.2-r4
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.2.4-r1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.62
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1-r1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.25-r3
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=k8 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /var/bind /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/grid-security/certificates /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=k8 -pipe"
DISTDIR="/net/teran/d0/nfs/gentoo/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps y"
FEATURES="buildpkg distcc distlocks parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LDFLAGS=""
LINGUAS="en sl"
MAKEOPTS="-j32"
PKGDIR="/net/teran/d0/nfs/gentoo/packages/amd64.gcc4"
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"
PORTDIR_OVERLAY="/usr/portage/local/layman/xemacs /usr/portage/local/layman/sunrise /usr/portage/local/layman/pro-audio /usr/portage/local/layman/kde /usr/portage/local/layman/desktop-effects /net/teran/d0/nfs/gentoo/portage.local"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X Xaw3d a52 aac aalib accessibility accounting acl acpi admin afs aiglx aio alsa amarok amd64 amr amrnb amrwb ansi ao apache2 applet arts asf athena atlas avahi bash-completion bcmath beagle berkdb bidi binfilter bl blas bluetooth bonjour bonobo branding bzip2 cairo calendar canvas caps cdb cddb cdio cdparanoia cdr cern chm cjk clamav cli colordiff console context cpudetection cracklib crciprec crypt css ctype cups curl curlwrappers cvs cyrillic cyrus daap dba dbm dbox2 dbus dc1394 dedicated deprecated designer-plugin device-mapper dga dia directfb diskio divx4linux djvu dlloader doc dri dssi dts dv dvb dvd dvdr dvi dxr3 edl eds elf elisp emacs emacs-w3 enblend enca encode esd exif exiv2 expat extensible extra fame fastcgi fat fbcon festival ffmpeg fftw filepicker firefox fits flac flatfile float fluidsynth font-server foomaticdb fortran fping freebox freetts ftp fuse gadu galago games gcj gcl gd gdbm gif gimp gimpprint glitz gmp gnokii gnome gnuplot gnutls gphoto2 gpm gps graphics graphviz groupwise gsf gstreamer gtk gtk2 gtkhtml guile hal hash hdhomerun hfs howl hpn htmlhandbook humanities hyperestraier ical iconv id3tag idn ieee1394 ifp imagemagick imap imlib inkjar innodb inotify iodbc ipod ipv6 irda isdnlog ithreads ivtv jack jadetex java java5 javascript jfs jingle joystick jpeg jpeg2k json junit kde kerberos keyring kig-scripting krb4 ktts ladspa lapack laptop latex lcd lcms ldap ldap-sasl ldapsam libcaca libclamav libnotify libsamplerate lirc live lm_sensors logrotate lua lyx lzo mad maps math matroska mbox mcve md5sum mdnsresponder-compat meanwhile messenger mfd-rewrites mhash midi mikmod mime mjpeg mmx mmxext mng modplug mono mozbranding mozdevelop mozilla mozsvg mp2 mp3 mp4 mpeg mpi mplayer msn mtp mudflap mule musepack music musicbrainz mysql mysqli nagios-dns nagios-ntp nagios-ping nas nautilus ncurses nemesi network networking networkmanager newxkb njb nls nptl nptlonly nsplugin ntfs nvidia nxclient objc odbc odk ogg ole omega openal openexr opengl openmp oscar oss overlays pam pcmcia pcntl pcre pda pdf pdo pear perl perlsuid php pic plotutils png pnm portaudio posix postfix postgres postgresql postscript povray ppds pppd prediction pstricks publishers pulseaudio pvr python qq qt qt-static qt3 qt3support qt4 quicktime quotas radio rar rdesktop reaa readline reflection regex reiser4 reiserfs rpc rtc ruby samba sasl sbcl scanner science sdl sdl-image seamonkey sendmail server session sift silc silvercity simplexml skey slang slp smime sms smux sndfile snmp soap sockets solver sound sox speex spell spl sql sqlite srt sse sse2 ssl ssse3 startup-notification subtitles subversion suhosin svg sysvipc t1lib taglib tcltk tcpd teletext tetex tex4ht tga theora threads thunderbird tidy tiff tk tokenizer transcode truetype truetype-fonts twolame type1-fonts unicode upnp usb utempter utf8 v4l v4l2 vcd vcdx vhosts visualization vorbis wavpack wddx webdav wifi wmf wxwindows x264 xanim xattr xcomposite xetex xface xfs xim xine xinerama xml xml2 xmlreader xmlrpc xmlwriter xmp xorg xpm xscreensaver xsl xulrunner xv xvid xvmc yaz zephyr zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci 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 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 proxy auth_digest authn_dbd asis cern_meta charset_lite dbd dumpio ident imagemap log_forensic proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http version" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en sl" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i810 mach64  mga neomagic nv r128 radeon rendition s3 s3virge savage siliconmotion sis      sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Tobias Klausmann (RETIRED) gentoo-dev 2008-06-05 10:29:01 UTC
A simple test is this script:
#/usr/bin/perl -w
use strict;
use Image:Magick;
die("Gone");

It never reaches the die(). Even if you put the die() before the use lines, it won't work, due to precompilation. Tested with 6.4.1.3 and 6.4.0.6. The former exhibits this problem, the latter doesn't.

The typical message is this:
Can't load '/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux/auto/Image/Magick/Magick.so' for module Image::Magick: libgomp.so.1: shared object cannot be dlopen()ed at /usr/lib64/perl5/5.8.8/x86_64-linux/DynaLoader.pm line 230.
 at ./rrd2-system.cgi line 4
Compilation failed in require at ./rrd2-system.cgi line 4.
BEGIN failed--compilation aborted at ./rrd2-system.cgi line 4.
Deep recursion on subroutine "Image::Magick::AUTOLOAD" at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux/Image/Magick.pm line 42.

Note that this does not erminate but eventually consumes all memory (and is OOM'ed)
Comment 4 Markus Meier gentoo-dev 2008-06-25 22:07:07 UTC
(In reply to comment #3)
> A simple test is this script:
> #/usr/bin/perl -w
> use strict;
> use Image:Magick;
> die("Gone");
> 
> It never reaches the die(). Even if you put the die() before the use lines, it
> won't work, due to precompilation. Tested with 6.4.1.3 and 6.4.0.6. The former
> exhibits this problem, the latter doesn't.

could you please test media-gfx/imagemagick-6.4.2.0? reopen and report upstream if it isn't fixed.

> 
> The typical message is this:
> Can't load
> '/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux/auto/Image/Magick/Magick.so' for
> module Image::Magick: libgomp.so.1: shared object cannot be dlopen()ed at

libomp linking was reported in bug #223817. Not sure if this is a dupe...

> /usr/lib64/perl5/5.8.8/x86_64-linux/DynaLoader.pm line 230.
>  at ./rrd2-system.cgi line 4
> Compilation failed in require at ./rrd2-system.cgi line 4.
> BEGIN failed--compilation aborted at ./rrd2-system.cgi line 4.
> Deep recursion on subroutine "Image::Magick::AUTOLOAD" at
> /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux/Image/Magick.pm line 42.
> 
> Note that this does not erminate but eventually consumes all memory (and is
> OOM'ed)
> 

Comment 5 Andrej Filipcic 2008-06-27 15:31:32 UTC
Still the same with media-gfx/imagemagick-6.4.2.0
Comment 6 Tobias Klausmann (RETIRED) gentoo-dev 2008-06-29 13:53:25 UTC
Near as I can tell, 6.4.2.0 is ok, both with the simple script and the app I found the bug with. The openmp issue (bug 223817) still exists.

Comment 7 Andrej Filipcic 2008-06-29 14:10:40 UTC
I can confirm the same, disabling openmp helps.
Comment 8 Markus Meier gentoo-dev 2008-07-05 16:19:52 UTC
thanks for the report, openmp is now disabled.
Comment 9 Holger Hoffstätte 2008-07-06 10:11:38 UTC
Hi and sorry for chiming in so late here. I just wanted to add a point that for me (32bit x86) the script in comment#3 works just fine, as does everything else in imagemagick when built with openmp. However I use gcc-4.3.1 (+ a fix for bug#228517) and not 4.2, and from how I understand bug#223817 the behaviour is more a problem with gcc 4.2 than with imagemagick.
Is there a sane way to disable openmp or let the ebuild fail only for gcc 4.2? My understanding is that 4.2 will not be stabilized in Gentoo and 4.3.1 already works much better anyway, so it seems odd to disable functionality when it works with a "current" setup.
Comment 10 Holger Hoffstätte 2008-08-16 14:38:56 UTC
Just one more data point, I just re-enabled openmp for 6.4.2.9 (for gcc 4.3.1) and the perl program still works fine. (after fixing the use line to have ::)
Comment 11 Markus Meier gentoo-dev 2008-08-16 16:51:50 UTC
  16 Aug 2008; Markus Meier <maekke@gentoo.org> metadata.xml,
  imagemagick-6.4.2.9.ebuild:
  reenable openmp support, but only with sys-devel/gcc-4.3

voila
Comment 12 Holger Hoffstätte 2008-08-16 17:00:39 UTC
(In reply to comment #11)

thanks =)