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

Bug 228977

Summary: sys-apps/portage-2.2_rc1 emerge/ebuild gets into a tight loop when merging glibc-2.8_p20080602
Product: Portage Development Reporter: Will Saxon <saxonww>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: ari, teidakankan
Priority: High Keywords: InVCS, REGRESSION
Version: unspecified   
Hardware: AMD64   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=610702
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 835380, 210077    
Attachments: prevent infinite loop in dblink._preserve_libs()
cache results to improve performance

Description Will Saxon 2008-06-22 23:01:56 UTC
I recently upgraded portage to 2.2_rc1. I then decided to emerge sys-devel/gcc-4.3.1, which pulled in sys-libs/glibc-2.8_p20080602 and dev-libs/mpfr-2.3.1.

mpfr merged fine, but during the qmerge step for glibc emerge began taking up 95+% cpu time and there was no disk activity, which is not normal behavior on my machine. Eventually I received terminal output about bzip compressing man pages, but nothing more. I used strace to see what the process was doing and noted a constant high speed rotation of lstat() and readlnk calls. See attached output.bz2

I canceled the merge and retried from the start. Same behavior. I tried again with 'ebuild /usr/portage/sys-libs/glibc/glibc-2.8_p20080602.ebuild merge'. I noticed the same behavior.

I then downgraded from portage-2.2_rc1 to portage 2.1.4.4 and tried to merge glibc again. glibc merged successfully. 

Reproducible: Didn't try

Steps to Reproduce:
1.Upgrade portage to 2.2_rc1
2.emerge glibc-2.8_p20080602
3.
Actual Results:  
emerge/ebuild hangs during the qmerge stage.

Expected Results:  
emerge should have successfully merged the new version of glibc

Note the following is after downgrading portage, completing the glibc/gcc upgrade and making gcc 4.3.1 my default:

Portage 2.1.4.4 (default-linux/amd64/2007.0, gcc-4.3.1, glibc-2.8_p20080602-r0, 2.6.25-tuxonice-r4 x86_64)
=================================================================
System uname: 2.6.25-tuxonice-r4 x86_64 AMD Athlon(tm) 64 Processor 3000+
Timestamp of tree: Sat, 21 Jun 2008 23:15:02 +0000
app-shells/bash:     3.2_p39
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.5.2-r4
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.2.5
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.62
sys-devel/automake:  1.5, 1.7.9-r1, 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=athlon64 -pipe -fomit-frame-pointer"
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"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=athlon64 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://mirror.mcs.anl.gov/pub/gentoo/"
LANG="en_US"
LC_ALL="en_US"
LINGUAS="en en_US"
MAKEOPTS="-j2"
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"
PORTDIR_OVERLAY="/usr/portage/local/layman/gentoo-china /usr/portage/local/layman/desktop-effects"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="3dnow X a52 aac acl acpi alsa amd64 arts bash-completion berkdb bzip2 cairo cddb cdparanoia cli cracklib crypt cups dbus dri dvd dvdr ffmpeg flac gdbm gif gimp gnutls gpm hal hddtemp iconv isdnlog java joystick jpeg kde lm_sensors logitech-mouse midi mmap mmx mng mp3 mpeg mplayer mudflap ncurses newspr nls nptl nptlonly nsplugin ogg opengl openmp pam pcre pdf perl png pppd python qt3 readline reflection session spl sse sse2 ssl svg syslog tcpd theora threads tiff truetype unicode usb vim-syntax vorbis x264 xcb xcomposite xine xml xorg xscreensaver xv xvid 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" APACHE2_MPMS="worker" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US" USERLAND="GNU" VIDEO_CARDS="nv nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

My system is an AMD Athlon64 3000+ with 1GB ram and 1 160GB SATA hard drive. I was running emerge in a kde konsole. Other running programs included the normal kde stuff, konqueror, kopete and mutt.

uname output:

Linux thundarr 2.6.25-tuxonice-r4 #1 PREEMPT Tue May 27 19:52:45 EDT 2008 x86_64 AMD Athlon(tm) 64 Processor 3000+ AuthenticAMD GNU/Linux
Comment 1 Will Saxon 2008-06-22 23:08:55 UTC
I am not able to get an attachment uploaded due to a bugzilla internal error. Here is an excerpt of the attachment, which is just a capture of strace running against the ebuild process:

lstat("/usr/kde/3.5/lib64", {st_mode=S_IFDIR|0755, st_size=20480, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/kde", {st_mode=S_IFDIR|0755, st_size=16, ...}) = 0
lstat("/usr/kde/3.5", {st_mode=S_IFDIR|0755, st_size=111, ...}) = 0
lstat("/usr/kde/3.5/lib64", {st_mode=S_IFDIR|0755, st_size=20480, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/kde", {st_mode=S_IFDIR|0755, st_size=16, ...}) = 0
lstat("/usr/kde/3.5", {st_mode=S_IFDIR|0755, st_size=111, ...}) = 0
lstat("/usr/kde/3.5/lib64", {st_mode=S_IFDIR|0755, st_size=20480, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/kde", {st_mode=S_IFDIR|0755, st_size=16, ...}) = 0
lstat("/usr/kde/3.5", {st_mode=S_IFDIR|0755, st_size=111, ...}) = 0
lstat("/usr/kde/3.5/lib64", {st_mode=S_IFDIR|0755, st_size=20480, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib64", {st_mode=S_IFDIR|0755, st_size=53248, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/kde", {st_mode=S_IFDIR|0755, st_size=16, ...}) = 0
lstat("/usr/kde/3.5", {st_mode=S_IFDIR|0755, st_size=111, ...}) = 0
lstat("/usr/kde/3.5/lib64", {st_mode=S_IFDIR|0755, st_size=20480, ...}) = 0
lstat("/lib64", {st_mode=S_IFDIR|0755, st_size=8192, ...}) = 0
lstat("/lib64", {st_mode=S_IFDIR|0755, st_size=8192, ...}) = 0
lstat("/lib64", {st_mode=S_IFDIR|0755, st_size=8192, ...}) = 0
lstat("/lib64", {st_mode=S_IFDIR|0755, st_size=8192, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib64", {st_mode=S_IFDIR|0755, st_size=53248, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib64", {st_mode=S_IFDIR|0755, st_size=53248, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/kde", {st_mode=S_IFDIR|0755, st_size=16, ...}) = 0
lstat("/usr/kde/3.5", {st_mode=S_IFDIR|0755, st_size=111, ...}) = 0
lstat("/usr/kde/3.5/lib64", {st_mode=S_IFDIR|0755, st_size=20480, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/qt", {st_mode=S_IFDIR|0755, st_size=14, ...}) = 0
lstat("/usr/qt/3", {st_mode=S_IFDIR|0755, st_size=151, ...}) = 0
lstat("/usr/qt/3/lib64", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib64", {st_mode=S_IFDIR|0755, st_size=53248, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib64", {st_mode=S_IFDIR|0755, st_size=53248, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib64", {st_mode=S_IFDIR|0755, st_size=53248, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib64", {st_mode=S_IFDIR|0755, st_size=53248, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib64", {st_mode=S_IFDIR|0755, st_size=53248, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib64", {st_mode=S_IFDIR|0755, st_size=53248, ...}) = 0
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/usr/lib64",  <unfinished ...>
Process 1899 detached

The attachment I have is ~3MB uncompressed and it is just more of the above.
Comment 2 Zac Medico gentoo-dev 2008-06-23 01:26:40 UTC
Created attachment 158059 [details, diff]
prevent infinite loop in dblink._preserve_libs()

I haven't tried to reproduce the bug, but I think this might fix it.
Comment 3 teidakankan 2008-06-23 04:03:42 UTC
(In reply to comment #2)
> Created an attachment (id=158059) [edit]
> prevent infinite loop in dblink._preserve_libs()
> 
> I haven't tried to reproduce the bug, but I think this might fix it.
> 

Tried this on ~x86.  Patch applied cleanly, but still hung at same point addressed above.  Downgraded to portage-2.1.5.6 and glibc finished merge successfully.
Comment 4 Zac Medico gentoo-dev 2008-06-23 10:09:19 UTC
Created attachment 158093 [details, diff]
cache results to improve performance

The problem is actually a performance issue (at least it is with the first patch applied). It's most noticeable with glibc since it provides so many libs.

This patch greatly improves the performance of dblink._preserve_libs() calls by caching results of LinkageMap.findProviders(), LinkageMap.findConsumers(), and os.path.realpath() calls .
Comment 5 teidakankan 2008-06-24 04:32:38 UTC
(In reply to comment #4)
> Created an attachment (id=158093) [edit]
> cache results to improve performance
> 
> The problem is actually a performance issue (at least it is with the first
> patch applied). It's most noticeable with glibc since it provides so many libs.
> 
> This patch greatly improves the performance of dblink._preserve_libs() calls by
> caching results of LinkageMap.findProviders(), LinkageMap.findConsumers(), and
> os.path.realpath() calls .
> 

This patch worked fine here and the actual file install process was a lot quicker then portage-2.1.5.6 once it began -- which seems to take a long time on glibc. Thanks for your help.
Comment 6 Andreas Arens 2008-06-28 08:47:20 UTC
The performance issue seems major. I see same on a fast quad (2008.0, portage 2.2-rc1, gcc-4.2.4. ~amd64).
I did wait 5 minutes..
The patch should be applied asap.
Comment 7 Zac Medico gentoo-dev 2008-07-23 07:57:45 UTC
This is fixed in 2.2_rc2.