Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 419671

Summary: www-client/firefox, mail-client/thunderbird ebuilds should check RAM+swap size
Product: Gentoo Linux Reporter: Sasha Polonsky <apl>
Component: Current packagesAssignee: Mozilla Gentoo Team <mozilla>
Status: RESOLVED OBSOLETE    
Severity: minor CC: cruzki123, denkpadje, herrtimson, jdhore, tsmksubc
Priority: Normal    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Screenshots showing memory usage

Description Sasha Polonsky 2012-06-04 22:39:33 UTC
I have a machine with 512M of RAM and 500M of swap space. Its CPU is slow enough, so compilation of firefox 10.x, thunderbird 10.x and chromium takes several hours. And all these hours are wasted, because when the compilation is over, linker uses all RAM and all swap, and then OOM killer kills it. So I should add more swap and try again, spending more time. BTW, 512M RAM + 500M swap is more than enough to run firefox, thunderbird and chromium at the same time in VNC session with Gnome 2.32. Bottom line is - ebuild should check how much RAM and swap the machine has before trying to emerge anything. In my experience, with 512M of RAM you need at least 1G of swap space.

Reproducible: Always

Steps to Reproduce:
1. Find the machine with 512M of RAM + less than 1G of swap space
2. Try to emerge either of firefox, thunderbird or chromium.

Actual Results:  
After several hours of compilation behold linker being killed by OOM killer, thus failing all emerge process, because it just cannot do its job because of the lack of memory

Expected Results:  
Before trying to emerge, the RAM and swap size should be checked. If the machine has 512M of RAM and less than 1G of swap, the error message should be printed and emerge process should fail.

Portage 2.1.10.11 (default/linux/x86/10.0, gcc-4.4.5, glibc-2.13-r2, 2.6.34-xen-r4 i686)
=================================================================
System uname: Linux-2.6.34-xen-r4-i686-AMD_Sempron-tm-_2400+-with-gentoo-2.0.2
Timestamp of tree: Mon, 04 Jun 2012 00:30:01 +0000
app-shells/bash:          4.1_p9
dev-lang/python:          2.6.6-r2
dev-util/cmake:           2.8.4-r1
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.2
sys-apps/openrc:          0.8.2-r1
sys-apps/sandbox:         1.6-r2
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.2, 1.11.1
sys-devel/binutils:       2.20.1-r1
sys-devel/gcc:            4.4.5
sys-devel/gcc-config:     1.4.1
sys-devel/libtool:        2.2.10
sys-devel/make:           3.82
sys-kernel/linux-headers: 2.6.38 (virtual/os-headers)
sys-libs/glibc:           2.13-r2
Repositories: gentoo
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="*"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O3 -march=i686 -pipe  -mno-tls-direct-seg-refs"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O3 -march=i686 -pipe  -mno-tls-direct-seg-refs"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
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=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X berkdb branding bzip2 cairo cli corefonts cracklib cups custom-cflags custom-optimization cxx dbus djvu exif fortran gdbm gnome iconv icu jpeg libnotify mng modules ncurses networkmanager nocxx nptl openmp pam pcre perl png policykit pppd python readline samba secure-delete session ssl startup-notification svg system-sqlite tcpd tiff truetype unlock-notify x86 xorg xulrunner zlib" 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 cgi cgid 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" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Jory A. Pratt gentoo-dev 2012-06-05 01:23:57 UTC
Firefox and Thunderbird both have a check to ensure that 4G is avaliable, it warns if failure is possible. I am not gonna make them errors as any combination of useflags can change this effect.
Comment 2 Kai Damm 2012-06-05 10:40:14 UTC
The "4GiB" check is just for disk space at ${PORTAGE_TMPDIR}. Maybe 512MiB memory+swap are not enough, at least not for all three of them at the same time.
Comment 3 Mike Gilbert gentoo-dev 2012-06-05 15:51:48 UTC
Giving this one to mozilla. Please file a separate bug for chromium.
Comment 4 Jeff (JD) Horelick (RETIRED) gentoo-dev 2012-06-05 18:25:41 UTC
Perhaps on that little an amount of ram you should use firefox-bin or thunderbird-bin or google-chrome (the precompiled binary packages of firefox, thunderbird and chromium, respectively).
Comment 5 Sasha Polonsky 2012-06-06 11:46:55 UTC
Created attachment 314403 [details]
Screenshots showing memory usage

to Kai Damm: I have attached a screenshot from my Gnome desktop. It shows firefox with four tabs, thunderbird and memory usage shown by top in the terminal window. As you see, only 478 out of 512M of RAM are used and swap is not used at all.
Comment 6 Kai Damm 2012-06-06 11:55:08 UTC
Okay, I'm not affected by the bug, I have plenty of RAM and disk space. I just wanted to comment that the 4G mentioned in comment #1 are not the cause of the bug report.

Checking the sum of the space requirements of all to-be-merged packages would be a nice portage feature, but that's clearly not in the scope of this bug.
Comment 7 Kai Damm 2012-06-06 15:18:01 UTC
Just to clarify: With comment #2 I meant the memory required to emerge the packages, not the memory needed while running the programs. 

According to your experience, the threshold should be raised.

There definitely is a warning. Even with enough RAM/space, there is at least the message "Checking for at least 4GB... and 512MB..." in emerge's output.

To let emerge fail in that case would be excessive, because the actual requirement cannot be predicted - I have seen firefox emerge successfully on a system with 3.2 GiB space left, despite the warning about 4GiB. The same applies to the RAM requirement - with different use flags this might be very different.
Comment 8 Jory A. Pratt gentoo-dev 2012-06-08 03:48:42 UTC
*** Bug 420155 has been marked as a duplicate of this bug. ***
Comment 9 Franz Trischberger 2012-06-08 07:53:15 UTC
The same was reported back in february:
https://bugs.gentoo.org/show_bug.cgi?id=402359
Since then, I experienced this issue with all firefox-12.0-revision + 13.0:
4GB RAM + 4GB SWAP, system stays unusable for minutes while linking.
Comment 10 Jory A. Pratt gentoo-dev 2012-06-09 16:02:41 UTC
Comment on attachment 314403 [details]
Screenshots showing memory usage

Please remember to change mimetype to match appropriately.
Comment 11 cruzki 2013-01-12 23:29:30 UTC
I have this issue with a 2GB RAM + 1GB SWAP. Moreover, I even have had problems with a 4GB RAM machine so I think that the pre merge check of 4 GB of RAM + SWAP is needed as well as the 8GB of disk space.
Comment 12 tt_1 2017-04-02 11:36:20 UTC
Firefox needs approx. 2gb of ram during linking - without debug flags on amd64 with -j4 ram consumption goes up to 3gb for the compiling and doubles up to 6gb with debug flags. 

So yeah, if it is not much of a deal to implement a check for this, I'd appreciate it.
Comment 13 Jory A. Pratt gentoo-dev 2017-08-26 17:57:42 UTC
If you feel I have closed your bug and it is still a current issue, please reopen and update it completely. We will not work bugs that have no ebuild in tree any longer or can not be reproduced with a current system.

Thank You for your support and understanding
The Mozilla Team