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

Bug 730312

Summary: dev-lang/python-3.7.8 compiled with -O0: Segmentation fault in _PyArg_UnpackStack
Product: Gentoo Linux Reporter: LE GARREC Vincent <gentoo.bugzilla>
Component: Current packagesAssignee: Python Gentoo Team <python>
Status: UNCONFIRMED ---    
Severity: normal CC: gentoo.bugzilla
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log.gz
backtrace_full.log.gz

Description LE GARREC Vincent 2020-07-01 09:07:10 UTC
I can build serf-1.3.9 but I can't build serf-1.3.9-r1 and serf-1.3.9-r2.

Maybe it the migration from API=5 to 7

Reproducible: Always

Actual Results:  
/home/legarrec/info/portage/net-libs/serf-1.3.9-r1/temp/environment: line 1196:    40 Segmentation fault      (core dumped) "${@}"



Portage 2.3.103 (python 3.7.8-final-0, default/linux/amd64/17.0/desktop/gnome/systemd, gcc-10.0.1, glibc-2.31-r5, 5.4.17-gentoo x86_64)
=================================================================
System uname: Linux-5.4.17-gentoo-x86_64-Intel-R-_Core-TM-_i7-3770_CPU_@_3.40GHz-with-gentoo-2.7
KiB Mem:    16348900 total,   1341364 free
KiB Swap:    9767516 total,   9561180 free
Timestamp of repository gentoo: Mon, 29 Jun 2020 14:30:01 +0000
Head commit of repository gentoo: 699f337091c0f6dbea147bca493b5040bb4d12d3
sh bash 5.0_p17
ld GNU ld (Gentoo 2.33.1 p2) 2.33.1
app-shells/bash:          5.0_p17::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.30.3-r1::gentoo
dev-lang/python:          2.7.18::gentoo, 3.6.10-r2::gentoo, 3.7.8::gentoo, 3.8.3::gentoo, 3.9.0_beta3::gentoo
dev-util/cmake:           3.16.4::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/sandbox:         2.20::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.2::gentoo
sys-devel/binutils:       2.33.1-r1::gentoo, 2.34-r1::gentoo
sys-devel/gcc:            8.3.0-r3::gentoo, 8.4.0-r1::gentoo, 9.2.0-r3::gentoo, 10.0.1_pre9999::gentoo, 11.0.0_pre9999::gentoo
sys-devel/gcc-config:     2.3.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.31-r5::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24

crossdev
    location: /home/legarrec/info/overlay
    masters: gentoo
    priority: 0

ssnb
    location: /var/lib/layman/ssnb
    masters: gentoo
    priority: 50

steam-overlay
    location: /var/lib/layman/steam-overlay
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O0 -ggdb2 -g2 -pipe -fno-omit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.6/conf"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /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="-march=native -O0 -ggdb2 -g2 -pipe -fno-omit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="-j9 --load-average=9"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=native -O0 -ggdb2 -g2 -pipe -fno-omit-frame-pointer"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news noclean parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O0 -ggdb2 -g2 -pipe -fno-omit-frame-pointer"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="fr_FR.UTF-8"
LDFLAGS="-Wl,--as-needed -Wl,-O0"
LINGUAS="fr en ja"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/home/legarrec/info"
USE="X a52 aac accessibility acl acpi alsa amd64 berkdb branding bzip2 cairo cdda cdr cli colord crypt cuda cups dbus dhcpcd dri dts dvd dvdr eds emboss encode evo exif flac fortran gdbm gif gnome gnome-online-accounts gpm gtk gtk3 iconv icu introspection ipv6 jpeg lcms ldap libnotify libsecret libtirpc mad mng mp3 mp4 mpeg multilib nautilus ncurses networkmanager nls nptl ogg opencl opengl openmp pam pango pcre pdf png policykit ppds pulseaudio qt5 readline sdl seccomp spell split-usr ssl startup-notification svg systemd tcpd tiff tracker truetype udev udisks unicode upower usb vorbis wayland wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2018" 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" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd 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="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4 sse4_1 sse4_2 ssse3" CURL_SSL="openssl" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="fr en ja" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="nlpsolver" OFFICE_IMPLEMENTATION="libreoffice" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python3_7" RUBY_TARGETS="ruby26" SANE_BACKENDS="canon_dr cardscan coolscan coolscan2 coolscan3 dc210 dc240 dc25 dell1600n_net dmc epjitsu epson epson2 fujitsu genesys gt68xx hp hp3500 hp3900 hp4200 hp5400 hp5590 hpljm1005 hs2p ibm kodak kodakaio kvs1025 kvs20xx leo lexmark ma1509 magicolor matsushita microtek microtek2 mustek mustek_usb nec net niash p5 pie pixma plustek plustek_pp qcam ricoh rts8891 s9036 sceptre sharp sm3600 sm3840 snapscan sp15c st400 stv680 tamarack teco1 teco2 teco3 test u12 umax umax1220u umax_pp xerox_mfp mustek_usb2" USERLAND="GNU" VIDEO_CARDS="nvidia" 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:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 LE GARREC Vincent 2020-07-01 09:07:51 UTC
Created attachment 647270 [details]
build.log.gz
Comment 2 LE GARREC Vincent 2020-07-01 14:52:53 UTC
file core-1593615141-scons-11.40

core-1593615141-scons-11.40: ELF 64-bit LSB core file, x86-64, version 1 (SYSV), SVR4-style, from '/usr/bin/python3.7 /usr/lib/python-exec/python3.7/scons -j9 PREFIX=/usr LIBDIR=', real uid: 250, effective uid: 250, real gid: 250, effective gid: 250, execfn: '/usr/lib/python-exec/python3.7/scons', platform: 'x86_64'
Comment 3 LE GARREC Vincent 2020-07-01 15:05:00 UTC
Created attachment 647316 [details]
backtrace_full.log.gz
Comment 4 Arfrever Frehtes Taifersar Arahesis 2020-07-02 08:16:15 UTC
> Core was generated by `/usr/bin/python3.7 /usr/lib/python-exec/python3.7/scons -j9 PREFIX=/usr LIBDIR='.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  0x00007f6051b05931 in _PyArg_UnpackStack (args=0x7f60505718d0, nargs=2, name=0x7f6051c0b5ae "_abc_instancecheck", min=2, 
>     max=<error reading variable: Cannot access memory at address 0x7f604fd00ff8>) at Python/getargs.c:2492
> 2492  {
> [Current thread is 1 (Thread 0x7f604fd40700 (LWP 64))]
> #0  0x00007f6051b05931 in _PyArg_UnpackStack (args=0x7f60505718d0, nargs=2, name=0x7f6051c0b5ae "_abc_instancecheck", min=2, 
>     max=<error reading variable: Cannot access memory at address 0x7f604fd00ff8>) at Python/getargs.c:2492
> #1  0x00007f6051b945b1 in _abc__abc_instancecheck (module=<module at remote 0x7f6050fbe230>, args=0x7f60505718d0, nargs=2) at ./Modules/clinic/_abc.c.h:99
> #2  0x00007f60519cb8b9 in _PyMethodDef_RawFastCallKeywords (method=0x7f6051ccc640 <module_functions+192>, self=<module at remote 0x7f6050fbe230>, 
>     args=0x7f60505718d0, nargs=2, kwnames=0x0) at Objects/call.c:654
> #3  0x00007f60519cbbde in _PyCFunction_FastCallKeywords (func=<built-in method _abc_instancecheck of module object at remote 0x7f6050fbe230>, 
>     args=0x7f60505718d0, nargs=2, kwnames=0x0) at Objects/call.c:732
> #4  0x00007f6051ae41e3 in call_function (pp_stack=0x7f604fd01510, oparg=2, kwnames=0x0) at Python/ceval.c:4568
> ...
> #247 0x00007f60519ceac3 in method_call (method=<method at remote 0x7f60501dd320>, args=(), kwargs=0x0) at Objects/classobject.c:309
> #248 0x00007f60519ca7e7 in PyObject_Call (callable=<method at remote 0x7f60501dd320>, args=(), kwargs=0x0) at Objects/call.c:245
> #249 0x00007f6051ba8b18 in t_bootstrap (boot_raw=0x7f604fdcd090) at ./Modules/_threadmodule.c:994
> #250 0x00007f6051b3aeb9 in pythread_wrapper (arg=0x5609617949f0) at Python/thread_pthread.h:174
> #251 0x00007f605175ef52 in start_thread (arg=<optimized out>) at pthread_create.c:477
> #252 0x00007f605187c61f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


Segmentation fault in /usr/bin/python3.7 would be a bug in dev-lang/python(:3.7) (or libc, kernel etc.).

Please rebuild kernel, sys-libs/glibc and dev-lang/python:* (at least dev-lang/python:3.7) with safer settings:

1. Without debugging flags:
  CFLAGS="-march=native -O2 -pipe"
  CXXFLAGS="-march=native -O2 -pipe"

2. With released version of compiler instead of sys-devel/gcc-10.0.1_pre9999:
  ~sys-devel/gcc-9.3.0
  ~sys-devel/gcc-10.1.0
Comment 5 Arfrever Frehtes Taifersar Arahesis 2020-07-02 08:21:58 UTC
Also try with ~dev-lang/python-3.7.7 or different slot.
Comment 6 LE GARREC Vincent 2020-07-02 08:38:51 UTC
Ouch, you're right, thanks. I shouldn't used gcc_pre9999. I'm using the _pre9999 only for personal test and for personal projects.

I'm currently upgrading @world for the first time after 3 months and it's taking days. I keep you in touch after I changed the version of gcc and when it's done.
Comment 7 LE GARREC Vincent 2020-07-02 21:38:08 UTC
After tests, the problem was the -O0. Thanks. I changed it with -O2 and it fine.
I knew that with -O0 I could have some "undefined symbol" bug but I never had other problem.
Do you think that I should post a bug to python dev ?
Comment 8 Arfrever Frehtes Taifersar Arahesis 2020-07-03 09:57:59 UTC
Can you reproduce the same problem with other slots (older, newer) of dev-lang/python?

I do not know if CPython upstream considers using -O0 as supported, but you can try to report problem in their bug tracker: https://bugs.python.org

You can also try test suite (FEATURES="test" USE="test") of dev-lang/python with -O0 and -O2 and compare results. Maybe there are more errors with -O0.
Comment 9 LE GARREC Vincent 2020-07-05 10:59:49 UTC
Tests don't fail with -O0. Python 3.7.7-r1 crashes with -O0 when compiling serf.

I didn't try with other slot. I enabled only the default python 3.7 on my system.

I open a issue https://bugs.python.org/issue41214

I think this bug should be changed to INVALID because Gentoo don't support -O0. Every time I update the repository, I run "sed -i "s/12sg/012sg/g" /usr/portage/eclass/flag-o-matic.eclass"
Comment 10 LE GARREC Vincent 2020-11-05 17:03:38 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #8)
> Can you reproduce the same problem with other slots (older, newer) of
> dev-lang/python?
> 
> I do not know if CPython upstream considers using -O0 as supported, but you
> can try to report problem in their bug tracker: https://bugs.python.org
> 
> You can also try test suite (FEATURES="test" USE="test") of dev-lang/python
> with -O0 and -O2 and compare results. Maybe there are more errors with -O0.

I migrated my system with python 3.8. I don't have the problem with python 3.8 and -O0.