Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
Bug 617518 - dev-lang/ruby-2.2.0-r1[jemalloc]: hangs during configure in sandbox
Summary: dev-lang/ruby-2.2.0-r1[jemalloc]: hangs during configure in sandbox
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 4 votes (vote)
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-04 19:16 UTC by Maciej Piechotka
Modified: 2020-05-26 20:07 UTC (History)
17 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Backtrace (logging.tmp,20.21 KB, text/plain)
2017-05-04 19:16 UTC, Maciej Piechotka
Details
offending source and backtrace (ruby_jemalloc-conftest.txt,15.62 KB, text/plain)
2018-06-17 22:34 UTC, Petr Cerny [:hrosik]
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Piechotka 2017-05-04 19:16:06 UTC
Created attachment 471682 [details]
Backtrace

checking for elf.h... yes
checking elf_abi.h usability... no
checking elf_abi.h presence... no
checking for elf_abi.h... no
checking whether OS depend dynamic link works... yes
checking for backtrace... yes
checking for broken backtrace...

Portage 2.3.5 (python 3.4.6-final-0, default/linux/amd64/13.0/desktop/gnome/systemd, gcc-5.4.0, glibc-2.24-r1, 4.9.21-hardened x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.9.21-hardened-x86_64-Intel-R-_Xeon-R-_CPU_E3-1505M_v5_@_2.80GHz-with-gentoo-2.3
KiB Mem:    65875224 total,  12007872 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Thu, 04 May 2017 04:00:01 +0000
sh bash 4.4_p12
ld GNU gold (Gentoo 2.27 p1.0 2.27) 1.12
distcc 3.2rc1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.4_p12::gentoo
dev-lang/perl:            5.24.1-r1::gentoo
dev-lang/python:          2.7.13::gentoo, 3.4.6::gentoo
dev-util/cmake:           3.8.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.25::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r3::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.12.6-r1::gentoo, 1.13.4-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.27::gentoo
sys-devel/gcc:            5.4.0-r3::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.24-r1::gentoo
Repositories:

(...)

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -ggdb"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/chromium/policies/managed/chrome-gnome-shell.json /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/opt/chrome/policies/managed/chrome-gnome-shell.json /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 -O2 -pipe -ggdb"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="-j8 --load-average=7"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs cgroup collision-protect compress-build-logs compressdebug config-protect-if-modified distlocks ebuild-locks fail-clean fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch preserve-libs protect-owned sandbox sfperms split-elog split-log splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -march=native -O2 -pipe -ggdb"
MAKEOPTS="-j8 -l7"
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="/var/tmp"
USE="X a52 aac acl acpi aes alsa amd64 archive avx avx2 berkdb bluetooth branding bzip2 cairo cdda cdr cli colord cracklib crossdev crypt cryptsetup cups cxx dbus device-mapper downloads-monitor dri dri3 dts dvd dvdr eds egl elfutils emacs emboss encode evo exif f16c fam firefox flac fma3 fortran fprint fuse gdbm gdm gif glamor gles glib gmp gnome gnome-keyring gnome-online-accounts gnuefi gold google googledrive gpg gphoto2 gpm graphite gssapi gstreamer gtk gtk3 hardened hidpi highlight iconv icu introspection ipv6 jemalloc jit jpeg jpeg2k justify kerberos latex lcms ldap libkms libnotify libproxy libsecret lz4 lzma mad mmx mmxext mng modules mp3 mp4 mpeg mtp multilib multitarget nautilus ncurses networkmanager nfs nls nptl ntlm ogg opengl openmp pam pango pax_kernel pcre pdf pie plymouth png policykit popcnt postgres ppds pulseaudio qt3support qt4 readline samba sasl sdl seccomp session smartcard smp spell sqlite sse sse2 sse3 sse4_1 sse4_2 ssh ssl ssp ssse3 startup-notification svg systemd tcpd telepathy theora threads tiff tracker truetype udev udisks unicode upower urandom usb uxa v4l vaapi vala vim-syntax vimeo vorbis vulcan wayland webkit webp wifi wireshark-plugins wxwidgets x264 xattr xcb xml xtpax xv xvid zeitgeist zeroconf zlib" ABI_X86="32 64" 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="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="BPF NVPTX X86 AArch64 ARM" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21 ruby22" USERLAND="GNU" VIDEO_CARDS="intel nvidia i965" 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_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

dev-lang/ruby-2.2.7::gentoo was built with the following:
USE="berkdb gdbm ipv6 jemalloc ncurses rdoc readline ssl -debug -doc -examples -libressl -rubytests -socks5 -tk -xemacs" ABI_X86="64"
CFLAGS="-march=native -O2 -pipe -ggdb -fno-strict-aliasing"
CXXFLAGS="-march=native -O2 -pipe -ggdb -fno-strict-aliasing"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
Comment 1 Nils Freydank 2017-05-04 20:28:01 UTC
I can confirm this. However, if I re-build jemalloc with USE="-hardened" and can configure and build ruby afterwards. Ergo ruby seems to need "--enable-syscall" in jemalloc, because jemalloc-hardening just disables it.

emerge --info:
Portage 2.3.5 (python 3.4.6-final-0, hardened/linux/amd64/no-multilib/selinux, gcc-5.4.0, glibc-2.23-r3, 4.11.0 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.11.0-x86_64-Intel-R-_Core-TM-_i5-4300U_CPU_@_1.90GHz-with-gentoo-2.3
KiB Mem:     8103328 total,    592384 free
KiB Swap:    8373568 total,   8373312 free
Timestamp of repository gentoo: Tue, 02 May 2017 18:04:04 +0000
sh bash 4.4_p12
ld GNU ld (Gentoo 2.27 p1.0) 2.27
distcc 3.2rc1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.4_p12::gentoo
dev-lang/perl:            5.24.1-r1::gentoo
dev-lang/python:          2.7.13::gentoo, 3.4.6::gentoo
dev-util/cmake:           3.8.0-r1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r3::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.13.4-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.27::gentoo
sys-devel/gcc:            5.4.0-r3::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo
Repositories:

gentoo
    location: /var/portage/tree
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    sync-git-clone-extra-opts: --branch master

local
    location: /usr/local/portage
    masters: gentoo
    priority: 0

holgersson-overlay
    location: /var/layman/holgersson-overlay
    sync-type: laymansync
    sync-uri: https://git.holgersson.xyz/holgersson-overlay
    masters: gentoo
    priority: 50

imaging
    location: /var/layman/imaging
    sync-type: laymansync
    sync-uri: https://github.com/gerddie/gentoo-imaging.git
    masters: gentoo
    priority: 50

kde
    location: /var/layman/kde
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/kde.git
    masters: gentoo
    priority: 50

perl-experimental
    location: /var/layman/perl-experimental
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/perl-overlay.git
    masters: gentoo
    priority: 50

Installed sets: @custom_KDE, @games
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=haswell -mcx16 -msahf -mabm -mlzcnt -mfxsr -mxsave -mxsaveopt --param=l1-cache-size=32 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=3072"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
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="-O2 -pipe -march=haswell -mcx16 -msahf -mabm -mlzcnt -mfxsr -mxsave -mxsaveopt --param=l1-cache-size=32 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=3072"
DISTDIR="/var/portage/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build --autounmask=n --binpkg-respect-use=y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg cgroup config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news nodoc noinfo parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="https://mirror.netcologne.de/gentoo/ https://tux.rainside.sk/gentoo/ https://www.mirrorservice.org/sites/distfiles.gentoo.org/"
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5 -l5"
PKGDIR="/var/portage/packages"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_FLAGS="-6 -T4"
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="/var/tmp"
USE="X a52 aac acl acpi alsa amd64 audit bash-completion berkdb bluetooth branding bzip2 c++11 c++14 caps cdda cli colord cracklib crypt cryptsetup cups cxx dbus djvu dri dts dvd dvdr encode exif fam firefox flac fontconfig gif git glamor gpg gpm graphicsmagick gstreamer hardened hunspell iconv icu int64 ipv6 jemalloc jit jpeg justify kipi lcms ldap libnotify lzma mng modules mp3 mp4 mpeg ncurses nftables nls nptl offensive ogg open_perms opengl openmp openmpi openmpi2 opus pam pax_kernel pcre pdf phonon pic pie pkcs11 plasma png policykit postscript pulseaudio qml qt5 quvi raw readline rtmp samba sasl sdl seccomp selinux semantic-desktop session smp sound spell ssh ssl ssp startup-notification svg systemd tcpd telepathy theora threads tiff truetype udev udisks unicode upower urandom usb v4l vaapi video vim-syntax vorbis vpx wavpack widgets wxwidgets x264 x265 xattr xcb xcomposite xkb xtpax xv xvid zlib zsh-completion" ABI_X86="64" ALSA_CARDS="hda-intel" 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="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev synaptics wacom" KERNEL="linux" L10N="de de_DE ru ru_RU" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de de_DE ru ru_RU" LLVM_TARGETS="BPF X86" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="intel i965" 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_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

dev-libs/jemalloc-4.4.0::gentoo was built with the following:
USE="-debug -hardened -static-libs -stats"


dev-lang/ruby-2.1.10::gentoo was built with the following:
USE="berkdb ipv6 ncurses rdoc readline ssl -debug -doc -examples -gdbm -rubytests -socks5 -tk -xemacs"
CFLAGS="-march=native -O2 -pipe -fno-strict-aliasing"
CXXFLAGS="-march=native -O2 -pipe -fno-strict-aliasing"


dev-lang/ruby-2.2.7::gentoo was built with the following:
USE="berkdb ipv6 jemalloc ncurses rdoc readline ssl -debug -doc -examples -gdbm -libressl -rubytests -socks5 -tk -xemacs"
CFLAGS="-O2 -pipe -march=haswell -mcx16 -msahf -mabm -mlzcnt -mfxsr -mxsave -mxsaveopt --param=l1-cache-size=32 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=3072 -fno-strict-aliasing"
CXXFLAGS="-O2 -pipe -march=haswell -mcx16 -msahf -mabm -mlzcnt -mfxsr -mxsave -mxsaveopt --param=l1-cache-size=32 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=3072 -fno-strict-aliasing"


dev-lang/ruby-2.4.1-r1::gentoo was built with the following:
USE="berkdb ipv6 jemalloc rdoc ssl -debug -doc -examples -gdbm -libressl -rubytests -socks5 -tk -xemacs"
CFLAGS="-O2 -pipe -march=haswell -mcx16 -msahf -mabm -mlzcnt -mfxsr -mxsave -mxsaveopt --param=l1-cache-size=32 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=3072 -fno-strict-aliasing"
CXXFLAGS="-O2 -pipe -march=haswell -mcx16 -msahf -mabm -mlzcnt -mfxsr -mxsave -mxsaveopt --param=l1-cache-size=32 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=3072 -fno-strict-aliasing"
Comment 2 Attila Tóth 2017-05-06 10:16:42 UTC
dev-lang/ruby-2.2.7-r1, dev-lang/ruby-2.3.4-r1 and dev-lang/ruby-2.4.1-r1 are all hang during configure at:
checking for broken backtrace...

This is happening since the ebuilds were recently modified from --enable-jemalloc to use --with-jemalloc instead.

Introduced by this commit:
dev-lang/ruby: fix building with USE=jemalloc
Hans de Graaff, Sun, 30 Apr 2017 10:37, commit 4816c5f5
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4816c5f5b99306a5698732ec9a0d959770672bad

So these changes supposed to fix jemalloc causing problems here and there.

If I kill configtest to skip the hanging detection, configure continues. However compile phase hangs again, the compiled miniruby binaries also seem to have problems. If I replace miniruby with a functioning copy, ebuilds compile ruby binaries that have problems as well.

So it seems to be a problem involving several versions of ruby.
I'm disabling jemalloc for ruby as a workaround.

BR: Dw.
Comment 3 Attila Tóth 2017-05-06 10:21:51 UTC
One more thing I had just noticed: the reporter of the bug is also using Hardened Gentoo. I'm currently running linux-4.9.24-hardened.
I cannot see any segfaults or denials in the logs, while configtest for backtrace or miniruby runs forever. The hanging binaries doesn't consume the resources of the system.
Also note, that pax-marking non-functional miniruby (-m or -Em) won't help.
Comment 4 Radoslaw Szkodzinski 2017-05-10 02:39:06 UTC
Confirming with dev-lang/ruby-2.4.5-r1, since previous versions built fine I suspect a bug in sandbox 2.10-r4.

Portage 2.3.5 (python 3.5.3-final-0, hardened/linux/amd64, gcc-5.4.0, glibc-2.23-r3, 4.8.12-ck8+ x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.8.12-ck8+-x86_64-Intel-R-_Xeon-R-_CPU_E31275_@_3.40GHz-with-gentoo-2.3
KiB Mem:    32701820 total,   3032604 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Mon, 08 May 2017 21:02:12 +0000
sh bash 4.4_p12
ld GNU ld (Gentoo 2.26.1 p1.0) 2.26.1
ccache version 3.3.4 [enabled]
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.1-r1::gentoo
dev-lang/python:          2.7.13::gentoo, 3.5.3::gentoo, 3.6.1-r1::gentoo
dev-util/ccache:          3.3.4::gentoo
dev-util/cmake:           3.8.0-r1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.25::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r3::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.12.6-r1::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25-r1::gentoo, 2.26.1::gentoo, 2.27::gentoo
sys-devel/gcc:            4.9.3::gentoo, 5.3.0::gentoo, 5.4.0-r3::gentoo, 6.3.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: git
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

local
    location: /usr/local/portage
    masters: gentoo
    priority: 0

gamerlay
    location: /var/lib/layman/gamerlay
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/gamerlay.git
    masters: gentoo
    priority: 50

mozilla
    location: /var/lib/layman/mozilla
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/mozilla.git
    masters: gentoo
    priority: 50

proaudio
    location: /var/lib/layman/proaudio
    sync-type: laymansync
    sync-uri: svn://svn.tuxfamily.org/svnroot/proaudio/proaudio/trunk/overlays/proaudio
    masters: gentoo
    priority: 50

sabayon
    location: /var/lib/layman/sabayon
    sync-type: laymansync
    sync-uri: git://github.com/Sabayon/for-gentoo.git
    masters: gentoo
    priority: 50

spike
    location: /var/lib/layman/spike
    sync-type: laymansync
    sync-uri: https://github.com/Spike-Pentesting/spike-overlay.git
    masters: gentoo
    priority: 50

vapoursynth
    location: /var/lib/layman/vapoursynth
    sync-type: laymansync
    sync-uri: https://github.com/4re/vapoursynth-portage.git
    masters: gentoo
    priority: 50

x11
    location: /var/lib/layman/x11
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/x11
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -fomit-frame-pointer -march=native -mfpmath=sse -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/conf.d /etc/init.d /usr/lib64/libreoffice/program/sofficerc /usr/share/config/kdm /usr/share/gnupg/qualified.txt"
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/skel /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -fomit-frame-pointer -march=native -mfpmath=sse -pipe"
DISTDIR="/var/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://gentoo.mirror.dkm.cz/pub/gentoo/ ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo http://ftp.uni-erlangen.de/pub/mirrors/gentoo rsync://gentoo.prz.rzeszow.pl/gentoo ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo"
LANG="pl_PL.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--sort-common -Wl,--hash-style=both"
MAKEOPTS="-j4 -l6"
PKGDIR="/var/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude=/metadata/cache --exclude=/metadata/md5-cache"
PORTAGE_RSYNC_OPTS="--recursive  --links  --safe-links  --perms  --times --force  --whole-file  --delete  --stats  --timeout=120 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac aacplus aacs accessibility acl acpi adns adplug aiglx aim alsa amd64 amr amrenc apparmor artswrappersuid audiofile audit auth-dns avahi avx bash-completion berkdb bidi bluetooth bluray branding btrfs bzip2 c++0x cairo caps cdda cddb cdio cdr celt cilk cjk cli connman cpudetection cracklib crypt cryptsetup cscope cups curl cxx dbi dbus devil dga djvu dri dri3 drm dts dv dvb dvd dvdr dvdread dvi efi encode exif expat f2fs fam fame fat fdk ffmpeg fftw firefox fits flac fluidsynth fontconfig foomatic-db fortran freetype fuse gcj gdbm geoip gif gimpprint glade glamor gme gmp gnome-keyring gnutls gpg gphoto2 gpm graphite graphviz gsm gstreamer gtk gtk3 gtkstyle gudev hardened harfbuzz hdri hfs highlight iconv icq icu idn iec61883 ieee1394 imagemagick imap inotify introspection ipod iproute2 ipv6 irc irda iso jabber jack jbig jemalloc jfs jit joystick jpeg jpeg2k json justify kdeenablefinal kdehiddenvisibility kerberos ladspa lame lash lcd ldap libass libcanberra libnotify libproxy libsamplerate libsecret libsoxr live lm_sensors lto lua lzma lzo mac mad mail matroska mdadm mjpeg mms mmx mng modplug modules mozdevelop mp3 mp3rtp mpeg msn mtp mudflap multilib multimedia musepack musicbrainz ncurses netlink network nls nptl nsplugin ntfs ntlm odf ogg openal opencl openexr opengl openmp openssl openvpn opus orc pam pango pax_kernel pcmcia pcre pda perl pgo pie plymouth png podcast policykit portaudio postproc postscript ppds pulseaudio python qt3support qt4 qt5 quvi rados rar raw rdesktop readline real realtime reiser4 reiserfs rle rss rtmp samba sasl scanner schroedinger sdl sdlgfx seccomp session sid slp smp snappy sndfile snmp socks socks5 speex spell sqlite sse3 sse4_1 sse4_2 ssh ssl ssp ssse3 startup-notification stream svg sysfs systemd taglib tcmalloc tcpd telepathy theora threads tiff truetype twolame udev unicode unwind urandom usb v4l v4l2 vaapi vala vcd vim-syntax visualization vorbis vpx wavpack webp wifi win32codecs wmf x264 x265 xattr xcb xen xine xinerama xml xpm xprint xtpax xulrunner xv xvid xvmc yahoo zeitgeist zeroconf zlib" ABI_X86="64 32" ALSA_CARDS="emu10k1x darla20 darla24 emu10k1 gina20 gina24 hdsp hdspm ice1712 indigo indigoio layla20 layla24 mia mixart mona pcxhr rme32 rme96 sb16 sbawe sscape usbusx2y vx222 usb-usx2y" 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" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="agfa_cl20 casio_qv dimagev dimera3500 kodak_dc120 kodak_dc210 kodak_dc240 kodak_dc3200 kodak_ez200 konica_qm150 panasonic_coolshot panasonic_dc1000 panasonic_dc1580 panasonic_l859 polaroid_pdc320 polaroid_pdc640 polaroid_pdc700 ricoh_g3 sipix_blink sipix_blink2 sipix_web2 sony_dscf1 sony_dscf55 toshiba_pdrm11 adc65 aox barbie canon clicksmart310 digigr8 digita directory enigma13 fuji gsmart300 hp215 iclick jamcam jd11 konica largan lg_gsm mars mustek pccam300 pccam600 ptp2 ricoh samsung sierra smal sonix soundvision spca50x sq905 stv0674 stv0680 sx330z template" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3 sse4_1 sse4_2 avx" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc efi-64 xen qemu multiboot" INPUT_DEVICES="evdev void vmmouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US pl" LIRC_DEVICES="audio audio_alsa serial pctv" LLVM_TARGETS="AMDGPU BPF AArch64 ARM Mips" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" QEMU_SOFTMMU_TARGETS="x86_64 arm armeb i386 mips mips64 mips64el mipsel mipsn32 aarch64" QEMU_USER_TARGETS="arm armeb i386 mips mipsel mips64 mips64el mipsn32 x86_64 aarch64" RUBY_TARGETS="ruby23 ruby24" USERLAND="GNU" VIDEO_CARDS="fbdev vesa radeon intel i965 i915 radeonsi amdgpu" 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"
USE_PYTHON="2.7 3.5"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS

=================================================================
                        Package Settings
=================================================================

dev-lang/ruby-2.2.5::gentoo was built with the following:
USE="berkdb gdbm ipv6 jemalloc ncurses rdoc readline socks5 ssl -debug -doc -examples -libressl -rubytests -tk -xemacs" ABI_X86="64"
CFLAGS="-O2 -march=native -mfpmath=sse -pipe -fno-strict-aliasing"
CXXFLAGS="-O2 -march=native -mfpmath=sse -pipe -fno-strict-aliasing"


dev-lang/ruby-2.3.3-r1::gentoo was built with the following:
USE="berkdb gdbm ipv6 jemalloc ncurses rdoc readline socks5 ssl -debug -doc -examples -libressl -rubytests -tk -xemacs" ABI_X86="64"
CFLAGS="-O2 -march=native -mfpmath=sse -pipe -fno-strict-aliasing"
CXXFLAGS="-O2 -march=native -mfpmath=sse -pipe -fno-strict-aliasing"


dev-lang/ruby-2.4.0::gentoo was built with the following:
USE="berkdb gdbm ipv6 jemalloc rdoc socks5 ssl -debug -doc -examples -libressl -rubytests -tk -xemacs" ABI_X86="64"
CFLAGS="-O2 -march=native -mfpmath=sse -pipe -fno-strict-aliasing"
CXXFLAGS="-O2 -march=native -mfpmath=sse -pipe -fno-strict-aliasing"
Comment 5 Radoslaw Szkodzinski 2017-05-10 05:05:12 UTC
Merging with FEATURE="-sandbox -usersandbox" is successful, so this is definitely a sandbox-related issue.
Comment 6 Hans de Graaff gentoo-dev 2017-05-10 05:18:00 UTC
(In reply to Attila Tóth from comment #2)

> This is happening since the ebuilds were recently modified from
> --enable-jemalloc to use --with-jemalloc instead.

Note that before this change USE=jemalloc did not actually use jemalloc (--enable-jemalloc is a no-op). So we are seeing this issues now because USE=jemalloc now actually works.
Comment 7 Hans de Graaff gentoo-dev 2017-05-10 05:19:06 UTC
(In reply to Radoslaw Szkodzinski from comment #5)
> Merging with FEATURE="-sandbox -usersandbox" is successful, so this is
> definitely a sandbox-related issue.

Adding sandbox maintainer to the bug.
Comment 8 Attila Tóth 2017-05-10 08:39:01 UTC
(In reply to Hans de Graaff from comment #6)
> (In reply to Attila Tóth from comment #2)
> 
> > This is happening since the ebuilds were recently modified from
> > --enable-jemalloc to use --with-jemalloc instead.
> 
> Note that before this change USE=jemalloc did not actually use jemalloc
> (--enable-jemalloc is a no-op). So we are seeing this issues now because
> USE=jemalloc now actually works.

Yeah, I got that. Please note, that all the reporters are using the hardened flavor so far. Other packages are using jemalloc without these symptoms. So I suspect there must be something wrong with the sandbox if using jemalloc on hardened systems the way ruby tries to do it. Unfortunately I cannot see any relevant log messages or denials. Consider adding hardened folks as well.
Comment 9 jy6x2b32pie9 2017-09-21 23:33:03 UTC
Having the same problem with non-hardened, without sandbox:

Portage 2.3.10 (python 3.5.4-final-0, default/linux/amd64/13.0/desktop, gcc-6.4.0, glibc-2.25-r5, 4.13.3-gentoo x86_64)
=================================================================
System uname: Linux-4.13.3-gentoo-x86_64-Intel-R-_Core-TM-_i3-4000M_CPU_@_2.40GHz-with-gentoo-2.4.1
KiB Mem:     8053304 total,   4624764 free
KiB Swap:   12582908 total,  12582908 free
Head commit of repository sk-overlay: 1181a39d7c3f56c3dbb21454767b3f0517d813f3

Timestamp of repository gentoo: Thu, 21 Sep 2017 19:30:01 +0000
Head commit of repository gentoo: 591de6c3bd0d7a69586256114fb276f080130b6e
sh bash 4.4_p12
ld GNU ld (Gentoo 2.29 p1.0) 2.29
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.26.0::gentoo
dev-lang/python:          2.7.14::gentoo, 3.5.4::gentoo, 3.6.1-r1::gentoo
dev-util/cmake:           3.9.3::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.31.2::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.15.1-r1::gentoo
sys-devel/binutils:       2.29::gentoo
sys-devel/gcc:            6.4.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)
sys-libs/glibc:           2.25-r5::gentoo
Repositories:

sk-overlay
    location: /usr/local/overlay/sk-overlay
    sync-type: git
    sync-uri: https://c.darenet.org/scriptkitties/overlay.git
    masters: gentoo

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: 40
    sync-rsync-extra-opts: 

jorgicio
    location: /var/lib/layman/jorgicio
    sync-type: laymansync
    sync-uri: https://github.com/jorgicio/jorgicio-gentoo.git
    masters: gentoo
    priority: 50

libressl
    location: /var/lib/layman/libressl
    sync-type: laymansync
    sync-uri: https://github.com/gentoo/libressl.git
    masters: gentoo
    priority: 50

steam-overlay
    location: /var/lib/layman/steam-overlay
    sync-type: laymansync
    sync-uri: git://github.com/anyc/steam-overlay.git
    masters: gentoo
    priority: 50

Installed sets: @archiver, @fonts
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
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"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--ask-enter-invalid"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs cgroup config-protect-if-modified distlocks ebuild-locks fail-clean fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirror.yandex.ru/gentoo-distfiles/"
LANG="en_US.utf8"
LDFLAGS="-march=native -O2 -pipe -Wl,-O2 -Wl,--as-needed -Wl,--sort-common"
MAKEOPTS="-j4"
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="/var/tmp"
USE="X a52 aac acl acpi adns alsa amd64 archive bash-completion berkdb branding btrfs bzip2 cairo caps cdda clang cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr egl emboss encode exif fam ffmpeg firefox flac fortran gdbm gif glamor gtk gtk3 hardened harfbuzz iconv icu idn ipv6 jemalloc jpeg lcms libcxx libnotify libressl lzma mad mng modules mp3 mp4 mpeg multilib natspec ncurses networkmanager nfs nls nptl offensive ogg opengl openmp pam pango pcre pdf pie png policykit ppds pulseaudio qt3support qt5 readline samba sdl seccomp session spell ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vaapi vorbis wxwidgets x264 xattr xcb xinerama xml xv xvid zlib zsh-completion" ABI_X86="64" 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="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="libressl" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev synaptics wacom" KERNEL="linux" L10N="en ru" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en ru" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python3_5 python3_6" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="intel i915 i965" XFCE_PLUGINS="battery brightness clock power" 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_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 10 jy6x2b32pie9 2017-09-21 23:38:57 UTC
Sorry for disinformation.
Sandbox was not explicitly enabled. But, apparently, profile-selected.
After explicitly disabling it, build completes.
Comment 11 Radoslaw Szkodzinski 2017-09-28 14:25:04 UTC
Still happening with ruby 2.4.2.
Comment 12 Radoslaw Szkodzinski 2017-09-28 14:34:11 UTC
Additionally, 2.4.2 w/ jemalloc segfaults during build in a miniruby call.
Comment 13 Steffen 'j0inty' Stollfuß 2017-12-04 08:23:51 UTC
Hi,

As I was switching to gcc-7.2.0 profile all my ruby:2.{2,3,4} slots won't compile any more with USE="jemalloc" flag.

I found a related article on github where I believe the problematic is discussed.

https://github.com/jemalloc/jemalloc/issues/1006


* As example ruby22 stops working with:

[snip]
[FATAL] Failed to create timer thread: Invalid argument
[/snap]

As temp fix you can remove USE flag "jemalloc".
Comment 14 Petr Cerny [:hrosik] 2018-06-17 22:34:09 UTC
Created attachment 536158 [details]
offending source and backtrace

Bitten by it several times (enough to look deeper): I'm attaching the hanging configure test (conftest.c) from ruby-2.5.1 and its backtrace when running with preloaded libsandbox (LD_PRELOAD=libsandbox.so) - it seems to be stuck on jemalloc's internal mutex.

My first guess is libsandbox calls libdl which is using malloc from glibc, but it clashes with the one provided by jemalloc.

For completeness my emerge --info, although I doubt it has anything to do with the problem:

Portage 2.3.28 (python 3.6.5-final-0, hardened/linux/amd64, gcc-7.3.0, glibc-2.26-r6, 4.12.3-gentoo x86_64)
=================================================================
System uname: Linux-4.12.3-gentoo-x86_64-QEMU_Virtual_CPU_version_2.5+-with-gentoo-2.4.1
KiB Mem:    28761524 total,  17491900 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sun, 17 Jun 2018 10:30:01 +0000
Head commit of repository gentoo: 78525384b77fc4a3fd2515a3cbc95d3447f5c85a
sh bash 4.4_p19
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
app-shells/bash:          4.4_p19::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.26.1-r2::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.5.4-r1::gentoo, 3.6.5::gentoo
dev-util/cmake:           3.10.3::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.35.5::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.15.1-r1::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.29.1-r1::gentoo, 2.30::gentoo
sys-devel/gcc:            5.4.0-r4::gentoo, 7.3.0-r1::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r3::gentoo
sys-kernel/linux-headers: 4.15::gentoo (virtual/os-headers)
sys-libs/glibc:           2.26-r6::gentoo
Repositories:

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

peterph
    location: /portage/overlays/peterph
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
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="-O2 -pipe"
DISTDIR="/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY 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="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg candy cgroup config-protect-if-modified distlocks ebuild-locks fakeroot fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="rsync://gentoo.mirror.dkm.cz/gentoo/"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_GB cs cs_CZ de de_DE fr fr_FR ro ro_RO"
MAKEOPTS="-j16"
PKGDIR="/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="/free"
USE="X a52 aac acl alsa amd64 amr amrenc apng berkdb bidi bzip2 c++11 cairo caps cdio celt cgroups cli crypt cryptsetup cups cxx dc1394 device-mapper directfb djvu dmraid dri dv dvb dvd dvi exif faac faad2 ffmpeg fftw fits flac fluidsynth fontconfig fontforge frei0r gcrypt gdal gdbm gif glut gme gmp gnutls gpg gpm graphviz gsm gstreamer gtk gtk3 hardened hdf5 hdri iconv icu id3tag iec61883 ieee1394 imagemagick introspection ipv6 jack jbig jemalloc jit jpeg jpeg2k kms ladspa lame lapack latex lcms libass libcaca libedit libilbc libnotify librtmp libsamplerate libsoxr libtirpc libv4l lua lzma mad matplotlib matroska midi mikmod modplug modules mp3 mpeg mpi multilib musepack ncurses nls nptl nsfw nss offensive ogg openal openexr opengl openh264 openmp openssl opus pango pcap pcre pdf pie plotutils png postproc postscript python qml qt readline rtmp rubberband schroedinger sdl sdl2 seccomp secure-delete smp snappy sndfile sox speex spell sqlite sse2 sse3 sse4_1 sse4_3 ssl ssp ssse3 svg taglib tcpd text theora threads tiff timidity tools truetype twolame udev unicode urandom utils v4l vaapi vdpau vim-syntax vorbis vpx wavpack webm webp x264 x265 xattr xcb xetex xinerama xkb xml xscreensaver xtpax xvid zeromq zimg zlib" ABI_X86="64" 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 plan sheets stage words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3 sse4_1 sse4_2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" L10N="en-GB cs" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python3_6 python2_7" RUBY_TARGETS="ruby25" USERLAND="GNU" VIDEO_CARDS="intel i915 i965 nouveau radeon" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 15 Alessandro Barbieri 2019-09-01 08:56:56 UTC
Version 2.6.4 have this problem too
Comment 16 Progenyx 2019-11-16 13:19:06 UTC
I'm unsure of the significance of this, but in my case, this just now started happening on my two setups, both hardened. So nothing like this before. It only started during the rebuilds following the update of jemalloc to v5.2.1. My solution was to temporarily disable jemalloc support in ruby.
Comment 17 Progenyx 2019-11-16 13:22:00 UTC
Please disregard my previous comment. I'm running stable builds, so that's probably the reason.
Comment 18 Felix Tiede 2019-11-16 15:04:39 UTC
Just seen this on stable hardened amd64, recompiling ruby-2.4.9 with USE="-jemalloc" solved it for me.
Comment 19 Progenyx 2020-04-19 11:31:18 UTC
Same with v2.4.10 and v2.5.8
Comment 20 Sven Schwyn (svoop) 2020-05-26 20:07:26 UTC
I'm compiling my Rubies from source (with ruby-install and chruby), but run into a similar problem when trying to compile Nginx with Passenger following this approach:

https://judsonlester.info/2016/01/15/nginx-passenger-on-gentoo/

During configuration of the Passenger nginx_module, Ruby is invoked and hangs if it uses hardened jemalloc. This happens across all current Ruby versions (tried 2.4.x thru 2.7.x). Workaround:

USE=-hardened emerge -av jemalloc

However, I'm not sure this is a good idea security-wise.