Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 345289 - sys-apps/portage-2.2.0_alpha4: traceback when hitting ctrl-c during fetch
Summary: sys-apps/portage-2.2.0_alpha4: traceback when hitting ctrl-c during fetch
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, REGRESSION
Depends on:
Blocks: 346909
  Show dependency tree
 
Reported: 2010-11-13 13:32 UTC by Davide Pesavento
Modified: 2024-02-12 07:58 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 Davide Pesavento (RETIRED) gentoo-dev 2010-11-13 13:32:45 UTC
>>> Emerging (1 of 14) x11-libs/qt-core-4.7.1
 * waiting for lock on /usr/portage/distfiles/.qt-everywhere-opensource-src-4.7.1.tar.gz.portage_lockfile
 ...
^C

Exiting on signal 2


Exiting on signal 2
Traceback (most recent call last):
  File "/usr/bin/emerge", line 43, in <module>
    retval = emerge_main()
  File "/usr/lib64/portage/pym/_emerge/main.py", line 1698, in emerge_main
    myopts, myaction, myfiles, spinner)
  File "/usr/lib64/portage/pym/_emerge/actions.py", line 443, in action_build
    retval = mergetask.merge()
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1129, in merge
    rval = self._merge()
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1449, in _merge
    self._main_loop_cleanup()
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1465, in _main_loop_cleanup
    self._task_queues.fetch.clear()
  File "/usr/lib64/portage/pym/_emerge/SequentialTaskQueue.py", line 79, in clear
    task.cancel()
  File "/usr/lib64/portage/pym/_emerge/SubProcess.py", line 54, in cancel
    self.wait()
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 40, in wait
    self._wait()
  File "/usr/lib64/portage/pym/_emerge/SubProcess.py", line 69, in _wait
    self.scheduler.schedule(self._reg_id, timeout=timeout)
  File "/usr/lib64/portage/pym/_emerge/PollScheduler.py", line 232, in _schedule_wait
    handler(f, event)
  File "/usr/lib64/portage/pym/_emerge/SpawnProcess.py", line 203, in _output_handler
    self._unregister_if_appropriate(event)
  File "/usr/lib64/portage/pym/_emerge/AbstractPollTask.py", line 45, in _unregister_if_appropriate
    self._unregister()
  File "/usr/lib64/portage/pym/_emerge/SubProcess.py", line 128, in _unregister
    f.close()
IOError: [Errno 9] Bad file descriptor
close failed in file object destructor:
IOError: [Errno 9] Bad file descriptor


# emerge --info

Portage 2.2.0_alpha4 (default/linux/amd64/10.0/desktop/kde, gcc-4.4.4, glibc-2.12.1-r1, 2.6.36-rc7-git1 x86_64)
=================================================================
System uname: Linux-2.6.36-rc7-git1-x86_64-Intel-R-_Core-TM-2_CPU_T7600_@_2.33GHz-with-gentoo-2.0.1
Timestamp of tree: Sat, 13 Nov 2010 11:15:01 +0000
ccache version 2.4 [disabled]
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r2
dev-lang/python:     2.6.6-r1
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1-r1
sys-apps/openrc:     0.6.3
sys-apps/sandbox:    2.3-r1
sys-devel/autoconf:  2.13, 2.68
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.4
sys-devel/make:      3.82
virtual/os-headers:  2.6.35 (sys-kernel/linux-headers)
Repositories: gentoo underlay
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA AdobeFlash-10.1 dlj-1.1"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=core2 -ggdb -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /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/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=core2 -ggdb -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://mirror.switch.ch/ftp/mirror/gentoo/"
LANG="it_IT.UTF-8"
LC_ALL="it_IT.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
LINGUAS="it"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_FLAGS=""
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--human-readable --prune-empty-dirs"
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/underlay"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 avahi bash-completion bluetooth branding bzip2 cairo caps cdda cddb cdr cli consolekit cracklib crypt curl cxx dbus djvu dri dts dv dvd dvdr emacs emboss encode exif expat fam ffmpeg fftw flac fontconfig ftp gd gdbm gif gmp gnutls gpm graphviz hal iconv idn ipod ipv6 java6 jingle jpeg jpeg2k kde kpathsea lame lcms ldap libsamplerate lm_sensors lua lzma lzo mad matroska mikmod mmap mmx mng modplug modules mp3 mp4 mpeg mudflap multilib musepack musicbrainz ncurses networkmanager nls nptl nptlonly offensive ogg opengl openmp pam pango pch pcre pdf png policykit ppds pppd pulseaudio qt3support qt4 quicktime readline rss sasl sdl session slang sndfile speex spell sqlite sqlite3 sse sse2 sse3 ssl ssse3 startup-notification svg sysfs syslog taglib tcpd theora threads tiff truetype unicode usb v4l2 vcd vorbis wifi x264 xattr xcb xcomposite xft xine xinerama xml xorg xpm xscreensaver xulrunner xv xvid zeroconf zlib zsh-completion" 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 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" 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="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="it" PHP_TARGETS="php5-2" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon vesa" 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, PORTAGE_BUNZIP2_COMMAND
Comment 1 Zac Medico gentoo-dev 2010-11-13 14:22:16 UTC
It seems that the traceback is occurring in the forked subprocess of the EbuildFetcher class. Normally, it calls os._exit(), and thereby bypasses the _main_loop_cleanup() code which is in a finally block. However, when it receives SIGTERM from the controlling terminal, the finally block gets triggered. In this case, the file descriptor is closed since EbuildFetcher closes all unneeded file descriptors after it forks the subprocess.
Comment 3 Zac Medico gentoo-dev 2010-11-25 06:17:36 UTC
This is in 2.2.0_alpha5, but this bug is also in 2.1.9.24, so I'll leave this bug open until it's in an unmasked release.
Comment 4 Zac Medico gentoo-dev 2010-11-27 18:25:40 UTC
This is fixed in 2.1.9.25.
Comment 5 Larry the Git Cow gentoo-dev 2024-02-12 07:58:06 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=419cce79f9082308c848df0a98f367de4d1c50a3

commit 419cce79f9082308c848df0a98f367de4d1c50a3
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2024-02-11 21:58:10 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2024-02-12 07:56:10 +0000

    process._exec: Use _start_fork for os.fork() error handling
    
    Use _start_fork for os.fork() error handling, ensuring
    that if exec fails then the child process will display
    a traceback before it exits via os._exit to suppress any
    finally blocks from parent's call stack (bug 345289).
    
    Bug: https://bugs.gentoo.org/345289
    Bug: https://bugs.gentoo.org/916566
    Bug: https://bugs.gentoo.org/924313
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/process.py | 259 ++++++++++++++++++++++++++++---------------------
 1 file changed, 151 insertions(+), 108 deletions(-)