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

Bug 403697

Summary: sys-apps/portage-2.1.10.46: TypeError: an integer is required
Product: Portage Development Reporter: Martin Mokrejš <mmokrejs>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 614112    
Bug Blocks: 651804    

Description Martin Mokrejš 2012-02-14 20:54:10 UTC
I have been updating some packages and after the very last, I got this:


 * Messages for package dev-python/PyQt4-4.9.1:

 * When updating dev-python/PyQt4, you usually need to rebuild packages, which depend on
 * dev-python/PyQt4, such as dev-python/qscintilla-python. If you have app-portage/gentoolkit
 * installed, you can find these packages with `equery d dev-python/PyQt4`.
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 2030, in emerge_main
    myopts, myaction, myfiles, spinner)
  File "/usr/lib64/portage/pym/_emerge/actions.py", line 442, in action_build
    retval = mergetask.merge()
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1054, in merge
    del failed_pkgs[:]
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1401, in _merge
    for pkg in self._pkg_queue:
  File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1417, in _main_loop_cleanup
  File "/usr/lib64/portage/pym/_emerge/SequentialTaskQueue.py", line 79, in clear
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 56, in cancel
    return self.returncode
  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 45, in wait
    if self.returncode is None:
  File "/usr/lib64/portage/pym/_emerge/SubProcess.py", line 85, in _wait
    # With waitpid and WNOHANG, only check the
  File "/usr/lib64/portage/pym/portage/__init__.py", line 230, in __call__
    rval = self._func(*wrapped_args, **wrapped_kwargs)
TypeError: an integer is required
# # emerge --info
Unavailable repository 'gentoo' referenced by masters entry in '/home/mmokrejs/proj/sci/metadata/layout.conf'
WARNING: One or more repositories have been ignored due to duplicate
  profiles/repo_name entries:

  /, x-portage, /usr/local/portage overrides
    /mnt/external/usr/portage

  All profiles/repo_name entries must be unique in order to avoid having
  duplicates ignored. Set PORTAGE_REPO_DUPLICATE_WARN="0" in
  /etc/make.conf if you would like to disable this warning.


Portage 2.1.10.46 (unavailable, gcc-4.5.3, glibc-2.14.1-r2, 3.2.5-default x86_64)
=================================================================
System uname: Linux-3.2.5-default-x86_64-Intel-R-_Core-TM-_i7-2640M_CPU_@_2.80GHz-with-gentoo-2.1
Timestamp of tree: Unknown
dev-lang/python:          2.7.2-r3::gentoo, 3.1.4-r3::gentoo, 3.2.2::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.68::gentoo
sys-devel/automake:       1.11.3::gentoo
sys-devel/binutils:       2.22-r1::gentoo
sys-devel/libtool:        2.4.2::gentoo
sys-kernel/linux-headers: 3.2::gentoo (virtual/os-headers)
Repositories: science x-portage x-layman
ACCEPT_KEYWORDS="~amd64"
ACCEPT_LICENSE="* -@EULA dlj-1.1 sun-bcla-java-vm Oracle-BCLA-JavaSE skype-eula Nero-EULA-US"
CFLAGS="-O2 -pipe -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /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 /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=native"
DISTDIR="/mnt/external/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news nostrip parallel-fetch protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/local/portage"
PORTDIR_OVERLAY="/home/mmokrejs/proj/sci /usr/local/portage /var/lib/layman"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl alsa amd64 amr apache apache2 berkdb bzip2 cairo cgi cli consolekit cracklib crypt cups dbus device-mapper dhcp dri emboss encode fax ffmpeg flac fontconfig fortran gd gdbm gimp gnome gpm gtk hal hpijs iconv id3tag innodb ipv6 java jce jpeg jpg ladspa laptop lcms libnotify mad mmx mpi mpich2 mysql ncurses nfs nls nptl nptlonly nsplugin ocr ogg opengl openmp openssl pam parport pcre pdf perl php png policykit ppds pppd python qt3support qt4 readline scanner server session sndfile sqlite sse sse2 sse3 ssl suexec svg syslog tcpd threads tiff tk truetype udev unicode usb wavpack xml xorg zlib"
Unset:  EMERGE_DEFAULT_OPTS, PORTAGE_BUNZIP2_COMMAND
Comment 1 Martin Mokrejš 2012-02-14 21:01:25 UTC
Ehm, do not know when this happened but my external USB drive with USB-stick modem connected to same USB hub crashed in the kernel. Maybe this is a false alarm. Will re-install PyQt4 after I repair the filesystem.
Comment 2 Martin Mokrejš 2012-02-14 22:14:59 UTC
So, I have successfully re-emerged =dev-python/PyQt4-4.9.1. Don't know what that really means. ;-)
Comment 4 Zac Medico gentoo-dev 2012-02-18 05:35:08 UTC
(In reply to comment #3)
> I suspect that python's os.fork() returns a non-integer sometimes. I've added
> some code to check for this case:
> 
> http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=11937db0fb2e25a30d855b084417f8d52547ff54
> http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=174da53469886a2d42e55326377d59e453b696c2

This debugging code is included in 2.1.10.47 and 2.2.0_alpha87.
Comment 5 Petr Nejedly 2015-09-04 23:18:25 UTC
Then, the assert triggered, this is what I got today:
>>> Running pre-merge checks for www-client/chromium-44.0.2403.89
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/emerge", line 50, in <module>
    retval = emerge_main()
  File "/usr/lib64/python2.7/site-packages/_emerge/main.py", line 1154, in emerge_main
    return run_action(emerge_config)
  File "/usr/lib64/python2.7/site-packages/_emerge/actions.py", line 3191, in run_action
    emerge_config.args, spinner)
  File "/usr/lib64/python2.7/site-packages/_emerge/actions.py", line 498, in action_build
    retval = mergetask.merge()
  File "/usr/lib64/python2.7/site-packages/_emerge/Scheduler.py", line 1005, in merge
    rval = self._run_pkg_pretend()
  File "/usr/lib64/python2.7/site-packages/_emerge/Scheduler.py", line 926, in _run_pkg_pretend
    current_task.wait()
  File "/usr/lib64/python2.7/site-packages/_emerge/AsynchronousTask.py", line 54, in wait
    self._wait()
  File "/usr/lib64/python2.7/site-packages/_emerge/CompositeTask.py", line 85, in _wait
    task.wait()
  File "/usr/lib64/python2.7/site-packages/_emerge/AsynchronousTask.py", line 54, in wait
    self._wait()
  File "/usr/lib64/python2.7/site-packages/_emerge/SubProcess.py", line 98, in _wait
    (self.__class__.__name__, repr(self.pid)))
AssertionError: EbuildProcess: pid is non-integer: None

I have re-merged python (while investigating this), but it happened the next time I have tried again.

I have just upgraded GCC before this happened, from 4.7.3 to 4.8.5
Comment 6 Zac Medico gentoo-dev 2015-09-05 20:08:13 UTC
(In reply to Petr Nejedly from comment #5)
>   File "/usr/lib64/python2.7/site-packages/_emerge/SubProcess.py", line 98,
> in _wait
>     (self.__class__.__name__, repr(self.pid)))
> AssertionError: EbuildProcess: pid is non-integer: None

This proves that the problem is not os.fork(), since otherwise a different assertion following fork would have been triggered.

I don't know where the None value comes from. I've reviewed the code, and I don't see how it's possible to trigger this case.

> I have re-merged python (while investigating this), but it happened the next
> time I have tried again.
> 
> I have just upgraded GCC before this happened, from 4.7.3 to 4.8.5

So, can you reproduce it reliably?
Comment 7 Vladimir Lushnikov 2016-03-19 23:47:44 UTC
I have now hit the same problem with pid is non-integer: None

This was while building inside a chroot (with GRS) and lots of custom overlays, so I am not going to post details here until I find exactly what's causing this.
Comment 8 Zac Medico gentoo-dev 2018-04-21 16:50:43 UTC
This issue is triggered by event loop recursion in the AbstractEbuildProcess._start() method, which leads to the SpawnProcess._wait() method being called before self.pid has been initialized. The patch for bug 614112 that fixes event loop recursion in AbstractEbuildProcess._start() will handle this.
Comment 9 Larry the Git Cow gentoo-dev 2018-04-29 00:49:35 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=3e235049eb36dd983b695ed50aca4e32d7d28950

commit 3e235049eb36dd983b695ed50aca4e32d7d28950
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-04-29 00:48:41 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-04-29 00:48:41 +0000

    AbstractEbuildProcess: use _async_waitpid after kill (bug 403697)
    
    Use _async_waitpid() instead of _async_wait() in the _cancel_timeout_cb
    method, since the pid exit status may not be available yet.
    
    Bug: https://bugs.gentoo.org/403697

 pym/_emerge/AbstractEbuildProcess.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)}
Comment 10 Zac Medico gentoo-dev 2018-04-29 02:09:22 UTC
(In reply to Larry the Git Cow from comment #9)
> The bug has been referenced in the following commit(s):
> 
> https://gitweb.gentoo.org/proj/portage.git/commit/
> ?id=3e235049eb36dd983b695ed50aca4e32d7d28950
> 
> commit 3e235049eb36dd983b695ed50aca4e32d7d28950
> Author:     Zac Medico <zmedico@gentoo.org>
> AuthorDate: 2018-04-29 00:48:41 +0000
> Commit:     Zac Medico <zmedico@gentoo.org>
> CommitDate: 2018-04-29 00:48:41 +0000
> 
>     AbstractEbuildProcess: use _async_waitpid after kill (bug 403697)

Actually the above commit is not relevant to this bug. The patch for bug 614112 is the one that's relevant:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=30c69adfc0ffa450ff3a4d4d176023db66171ae7
Comment 11 Zac Medico gentoo-dev 2018-07-02 18:39:36 UTC
Fixed in portage-2.3.40-r1.