Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 320859 - sys-apps/portage: emerge runs out of memory in fork call during install of gentoo-sources
Summary: sys-apps/portage: emerge runs out of memory in fork call during install of ge...
Status: RESOLVED DUPLICATE of bug 346749
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-21 11:59 UTC by Dennis
Modified: 2015-03-05 05:56 UTC (History)
5 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 Dennis 2010-05-21 11:59:17 UTC
Intel x64 System
New install with: portage-latest.tar.bz2 (from 20.05.2010) , stage-stage3-amd64-hardened+nomultilib-20100520.tar.bz2

/ = ext3
/boot = ext4



Reproducible: Always

Steps to Reproduce:
1. new install (in Virtual Box 3.1.6 OSE r59338), 512 MB RAM, 25 GB HDD
2. create filesystems and mount it under /mnt/gentoo
3. download stage3 and portage
3. tar xjpfv stage3-amd64-hardened+nomultilib-20100520.tar.bz2
4. tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr
5. mount -t proc none /mnt/gentoo/proc
   mount -o bind /dev /mnt/gentoo/dev
   mirrorselect -i -o >> /mnt/gentoo/etc/make.conf 
   cp /etc/resolv.conf /mnt/gentoo/etc
   chroot /mnt/gentoo
   env-update
   source /etc/profile

6. emerge-websync

7. cofigure /etc/make.conf

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j 3"
INPUT_DEVICES="keyboard mouse evdev"
USE="apci sse sse2 -ipv6 -gnome -kde -qt3 -qt4 gtk java X dbus hal \
 startup-notification xscreenserver"
LINGUAS="de en"

8. configure keymap and clock

9. env-update
   source /etc/profile
   emerge-websync
   emerge --update --deep world

10. configure /etc/hosts
    127.0.0.1 localhost gentoo

11. emerge gentoo-sources





Output from emerge gentoo-sources

>>> Installing (1 of 1) sys-kernel/gentoo-sources-2.6.32-r7
Traceback (most recent call last):
  File "/usr/bin/emerge", line 42, in <module>
    retval = emerge_main()
  File "/usr/lib64/portage/pym/_emerge/main.py", line 1410, in emerge_main
    myopts, myaction, myfiles, spinner)
  File "/usr/lib64/portage/pym/_emerge/actions.py", line 434, in action_build
    retval = mergetask.merge()
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 914, in merge
    rval = self._merge()
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1222, in _merge
    self._main_loop()
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1369, in _main_loop
    self._poll_loop()
  File "/usr/lib64/portage/pym/_emerge/PollScheduler.py", line 134, in _poll_loop
    handler(f, event)
  File "/usr/lib64/portage/pym/_emerge/SpawnProcess.py", line 198, in _output_handler
    self._unregister_if_appropriate(event)
  File "/usr/lib64/portage/pym/_emerge/AbstractPollTask.py", line 27, in _unregister_if_appropriate
    self.wait()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib64/portage/pym/_emerge/EbuildPhase.py", line 94, in _post_phase_exit
    self.wait()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib64/portage/pym/_emerge/TaskSequence.py", line 44, in _task_exit_handler
    self.wait()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 106, in _default_final_exit
    return self.wait()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib64/portage/pym/_emerge/EbuildPhase.py", line 94, in _post_phase_exit
    self.wait()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib64/portage/pym/_emerge/TaskSequence.py", line 44, in _task_exit_handler
    self.wait()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 106, in _default_final_exit
    return self.wait()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib64/portage/pym/_emerge/EbuildBuild.py", line 174, in _build_exit
    self.wait()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 106, in _default_final_exit
    return self.wait()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 42, in wait
    self._wait_hook()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 115, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1201, in _build_exit
    self._schedule()
  File "/usr/lib64/portage/pym/_emerge/PollScheduler.py", line 43, in _schedule
    return self._schedule_tasks()
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1391, in _schedule_tasks
    if q.schedule():
  File "/usr/lib64/portage/pym/_emerge/SequentialTaskQueue.py", line 56, in schedule
    task.start()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 24, in start
    self._start()
  File "/usr/lib64/portage/pym/_emerge/PackageMerge.py", line 44, in _start
    self.returncode = self.merge.merge()
  File "/usr/lib64/portage/pym/_emerge/MergeListItem.py", line 148, in merge
    retval = self._install_task.install()
  File "/usr/lib64/portage/pym/_emerge/EbuildBuild.py", line 276, in install
    rval = merge.execute()
  File "/usr/lib64/portage/pym/_emerge/EbuildMerge.py", line 27, in execute
    blockers=self.find_blockers)
  File "/usr/lib64/portage/pym/portage/dbapi/vartree.py", line 3331, in merge
    mydbapi=mydbapi, prev_mtimes=prev_mtimes)
  File "/usr/lib64/portage/pym/portage/dbapi/vartree.py", line 3212, in merge
    mydbapi=mydbapi, prev_mtimes=prev_mtimes)
  File "/usr/lib64/portage/pym/portage/dbapi/vartree.py", line 3221, in _merge
    cleanup=cleanup, mydbapi=mydbapi, prev_mtimes=prev_mtimes)
  File "/usr/lib64/portage/pym/portage/dbapi/vartree.py", line 2767, in treewalk
    ldpath_mtimes=prev_mtimes, others_in_slot=others_in_slot)
  File "/usr/lib64/portage/pym/portage/dbapi/vartree.py", line 1427, in unmerge
    self, self.vartree.dbapi, myebuildpath, ebuild_phase)
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 629, in _dblink_ebuild_phase
    ebuild_phase.start()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 24, in start
    self._start()
  File "/usr/lib64/portage/pym/_emerge/EbuildPhase.py", line 30, in _start
    self._start_task(ebuild_process, self._ebuild_exit)
  File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 119, in _start_task
    task.start()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 24, in start
    self._start()
  File "/usr/lib64/portage/pym/_emerge/EbuildProcess.py", line 20, in _start
    AbstractEbuildProcess._start(self)
  File "/usr/lib64/portage/pym/_emerge/SpawnProcess.py", line 115, in _start
    retval = self._spawn(self.args, **kwargs)
  File "/usr/lib64/portage/pym/_emerge/EbuildProcess.py", line 34, in _spawn
    mydbapi=mydbapi, tree=tree, **kwargs)
  File "/usr/lib64/portage/pym/portage/package/ebuild/doebuild.py", line 793, in doebuild
    fd_pipes=fd_pipes, returnpid=returnpid)
  File "/usr/lib64/portage/pym/portage/package/ebuild/doebuild.py", line 1235, in spawn
    mypids.extend(spawn_func(mystring, env=env, **keywords))
  File "/usr/lib64/portage/pym/portage/process.py", line 69, in spawn_bash
    return spawn(args, opt_name=opt_name, **keywords)
  File "/usr/lib64/portage/pym/portage/process.py", line 244, in spawn
    pid = os.fork()
  File "/usr/lib64/portage/pym/portage/__init__.py", line 228, in __call__
    rval = self._func(*wrapped_args, **wrapped_kwargs)
OSError: [Errno 12] Cannot allocate memory
Comment 1 Zac Medico gentoo-dev 2010-05-22 01:51:21 UTC
Please post `emerge --info` output.
Comment 2 Dennis 2010-05-28 11:42:45 UTC
Portage 2.1.8.3 (hardened/linux/amd64/10.0/no-multilib, gcc-4.3.4, glibc-2.10.1-r1, 2.6.31-gentoo-r10 x86_64)
=================================================================
System uname: Linux-2.6.31-gentoo-r10-x86_64-Intel-R-_Core-TM-2_CPU_6420_@_2.13GHz-with-gentoo-1.12.13
Timestamp of tree: Fri, 21 May 2010 01:45:01 +0000
app-shells/bash:     4.0_p37
dev-lang/python:     2.6.4-r1
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.63-r1
sys-devel/automake:  1.11.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc:       4.3.4
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=nocona -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://ftp6.uni-erlangen.de/pub/mirrors/gentoo ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/"
LDFLAGS="-Wl,-O1"
LINGUAS="de en"
MAKEOPTS="-j 3"
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"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl amd64 apci berkdb bzip2 cli cracklib crypt cups cxx dbus dri gdbm gpm gtk hal hardened iconv java justify mmx modules mudflap ncurses nls nptl nptlonly openmp pam pcre perl pic pppd python readline reflection session spl sse sse2 ssl starup-notification sysfs tcpd urandom xorg xscreensaver 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 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" LINGUAS="de en" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa via vmware voodoo" 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, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 3 Dennis 2010-05-28 12:43:28 UTC
After

emerge-websync 
emerge --update --deep world

the same problem.

Portage 2.1.8.3 (hardened/linux/amd64/10.0/no-multilib, gcc-4.3.4, glibc-2.10.1-r1, 2.6.31-gentoo-r10 x86_64)
=================================================================
System uname: Linux-2.6.31-gentoo-r10-x86_64-Intel-R-_Core-TM-2_CPU_6420_@_2.13GHz-with-gentoo-1.12.13
Timestamp of tree: Fri, 28 May 2010 01:45:02 +0000
app-shells/bash:     4.0_p37
dev-lang/python:     2.6.5-r2, 3.1.2-r3
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.65
sys-devel/automake:  1.11.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc:       4.3.4
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=nocona -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://ftp6.uni-erlangen.de/pub/mirrors/gentoo ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/"
LDFLAGS="-Wl,-O1"
LINGUAS="de en"
MAKEOPTS="-j 3"
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"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl amd64 apci berkdb bzip2 cli cracklib crypt cups cxx dbus dri gdbm gpm gtk hal hardened iconv java justify mmx modules mudflap ncurses nls nptl nptlonly openmp pam pcre perl pic pppd python readline reflection session spl sse sse2 ssl starup-notification sysfs tcpd urandom xorg xscreensaver 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 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" LINGUAS="de en" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa via vmware voodoo" 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, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 4 Sebastian Luther (few) 2010-05-28 12:54:52 UTC
What gives "free -m" right after emerge died?
Comment 5 Dennis 2010-05-28 12:57:34 UTC
i am so sorry, i forgot to create and activate SWAP space

please close the bug !

S O R R Y ! ! !
Comment 6 Sebastian Luther (few) 2010-05-28 13:12:00 UTC
I think we should keep it open. It's good to know where the places are, where lots of memory gets consumed.
Comment 7 Tiago Marques 2012-07-24 05:47:13 UTC
I'm also experiencing this problem during the tar extraction phase of an "emerge gentoo-sources".

It is fixed by adding swap but I find it strange that a 512MiB machine can compile almost everything, yet dies horribly extracting a tar.bz2

Best regards
Comment 8 Zac Medico gentoo-dev 2012-10-30 23:20:17 UTC
Maybe this helps:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5acf1392fdcac2470e504b211d40ee7606d2090a

Also, the stack trace in comment #1 shows excessive recursion in the Scheduler event handling, which was fixed in the changes related to bug #402335 (possibly reducing memory consumption related to the size of the call stack).
Comment 9 Christian Ruppert (idl0r) gentoo-dev 2012-10-31 15:38:29 UTC
(In reply to comment #8)
> Maybe this helps:
> 
> http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;
> h=5acf1392fdcac2470e504b211d40ee7606d2090a
> 
> Also, the stack trace in comment #1 shows excessive recursion in the
> Scheduler event handling, which was fixed in the changes related to bug
> #402335 (possibly reducing memory consumption related to the size of the
> call stack).

As I said in #gentoo-portage (IRC) - it doesn't help :(

>>> Installing (1 of 1) sys-kernel/gentoo-sources-3.4.9
Traceback (most recent call last):
  File "/usr/lib64/portage/pym/portage/dbapi/_MergeProcess.py", line 209, in _spawn
    prev_mtimes=self.prev_mtimes, counter=counter)
  File "/usr/lib64/portage/pym/portage/dbapi/vartree.py", line 4625, in merge
    counter=counter)
  File "/usr/lib64/portage/pym/portage/dbapi/vartree.py", line 4127, in treewalk
    phase.start()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 30, in start
    self._start()
  File "/usr/lib64/portage/pym/_emerge/EbuildPhase.py", line 131, in _start
    self._start_lock()
  File "/usr/lib64/portage/pym/_emerge/EbuildPhase.py", line 148, in _start_lock
    self._start_task(self._ebuild_lock, self._lock_exit)
  File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 147, in _start_task
    task.start()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 30, in start
    self._start()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousLock.py", line 52, in _start
    self.wait()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 57, in wait
    self._wait_hook()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 161, in _wait_hook
    self._exit_listener_stack.pop()(self)
  File "/usr/lib64/portage/pym/_emerge/EbuildPhase.py", line 157, in _lock_exit
    self._start_ebuild()
  File "/usr/lib64/portage/pym/_emerge/EbuildPhase.py", line 180, in _start_ebuild
    self._start_task(ebuild_process, self._ebuild_exit)
  File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 147, in _start_task
    task.start()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 30, in start
    self._start()
  File "/usr/lib64/portage/pym/_emerge/AbstractEbuildProcess.py", line 106, in _start
    SpawnProcess._start(self)
  File "/usr/lib64/portage/pym/_emerge/SpawnProcess.py", line 122, in _start
    retval = self._spawn(self.args, **kwargs)
  File "/usr/lib64/portage/pym/_emerge/EbuildProcess.py", line 21, in _spawn
    actionmap=actionmap, **kwargs)
  File "/usr/lib64/portage/pym/portage/package/ebuild/doebuild.py", line 105, in _doebuild_spawn
    return spawn(cmd, settings, **kwargs)
  File "/usr/lib64/portage/pym/portage/package/ebuild/doebuild.py", line 1422, in spawn
    return spawn_func(mystring, env=mysettings.environ(), **keywords)
  File "/usr/lib64/portage/pym/portage/process.py", line 81, in spawn_bash
    return spawn(args, opt_name=opt_name, **keywords)
  File "/usr/lib64/portage/pym/portage/process.py", line 259, in spawn
    pid = os.fork()
  File "/usr/lib64/portage/pym/portage/__init__.py", line 230, in __call__
    rval = self._func(*wrapped_args, **wrapped_kwargs)
OSError: [Errno 12] Cannot allocate memory
Comment 10 Dennis Schridde 2012-11-01 15:19:36 UTC
I also see this problem quite often on my IA64 machines. Retrying several times usually gets around the problem.
Comment 11 Marios Andreopoulos 2012-11-03 19:25:48 UTC
I also started seeing this problem with a ~amd64 hardened machine.
The machine has 768MB of RAM, with more than 500MB available for portage.

During installation phase, one instance of emerge starts consuming RAM until it reaches about 40% (300MiB) of my total RAM, where emerge exits with an out of memory error. The main instance of emerge remains constant at 50MiB during the whole process, until the OOM crash.

What is maybe worse, is that the files get partially installed in my system. For sources this isn't obviously a problem but for other ebuilds it could be.

# free -m
             total       used       free     shared    buffers     cached
Mem:           745        415        329          0         49        144
-/+ buffers/cache:        222        522
Swap:            0          0          0

# emerge --info
Portage 2.1.11.31 (hardened/linux/amd64/no-multilib, gcc-4.6.3, glibc-2.16.0, 3.6.3-hardened x86_64)
=================================================================
System uname: Linux-3.6.3-hardened-x86_64-Intel-R-_Pentium-R-_CPU_G840_@_2.80GHz-with-gentoo-2.2
Timestamp of tree: Sat, 03 Nov 2012 09:30:01 +0000
ld GNU ld (GNU Binutils) 2.23
app-shells/bash:          4.2_p39
dev-lang/python:          2.7.3-r2, 3.2.3-r1
dev-util/cmake:           2.8.9-r1
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.2
sys-apps/sandbox:         2.6
sys-devel/autoconf:       2.69
sys-devel/automake:       1.12.4
sys-devel/binutils:       2.23
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.6 (virtual/os-headers)
sys-libs/glibc:           2.16.0
Repositories: gentoo x-personal
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=native"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="el_GR.utf8"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/personal"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl amd64 berkdb bzip2 cli cracklib crypt cups cxx dri gdbm gmp hardened iconv icu ipv6 justify mmx modules mudflap mysql ncurses nls nptl openmp pam pax_kernel pcre php pppd readline session sse sse2 ssl tcpd unicode urandom 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 mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions access_compat alias auth_basic authn_alias authn_anon authn_core authn_dbm authn_default authn_file authz_core authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cache_disk 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 socache_shmcb speling status reqtimeout unique_id unixd usertrack vhost_alias proxy proxy_fcgi proxy_http proxy_balancer lbmethod_bytraffic" APACHE2_MPMS="worker" 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 evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-4" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" 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, LINGUAS, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 12 Zac Medico gentoo-dev 2015-03-04 23:00:52 UTC
(In reply to Zac Medico from comment #8)

Yeah, seems fixed since 5acf1392fdcac2470e504b211d40ee7606d2090a and the changes from bug 402335.
Comment 13 Zac Medico gentoo-dev 2015-03-05 05:55:25 UTC

*** This bug has been marked as a duplicate of bug 346749 ***