Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 803233 - net-im/telegram-desktop-2.8.1[01] won't start: <jemalloc>: Error in dlsym(RTLD_NEXT, "pthread_create")
Summary: net-im/telegram-desktop-2.8.1[01] won't start: <jemalloc>: Error in dlsym(RTL...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Esteve Varela Colominas
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2021-07-21 14:09 UTC by Paolo Pedroni
Modified: 2024-04-10 23:34 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 Paolo Pedroni 2021-07-21 14:09:29 UTC
I've tried rebuilding jemalloc and then telegram-desktop again, but to no avail.

telegram-desktop dumps core:
Process 2936641 (telegram-deskto) of user 1000 dumped core.
                                                      
Stack trace of thread 2936641:
#0  0x00007fc170e0fb04 raise (libc.so.6 + 0x38b04)
#1  0x00007fc170df9547 abort (libc.so.6 + 0x22547)
#2  0x00007fc1736acc23 pthread_create_fptr_init.part.0.lto_priv.0 (libjemalloc.so.2 + 0x13c23)
#3  0x00007fc1736a3da3 malloc_init_hard.lto_priv.0 (libjemalloc.so.2 + 0xada3)
#4  0x00007fc1736a42cd je_malloc_default (libjemalloc.so.2 + 0xb2cd)
#5  0x00007fc170e089ff n/a (libc.so.6 + 0x319ff)
#6  0x00007fc170e08c9f bindtextdomain (libc.so.6 + 0x31c9f)
#7  0x00007fc169aec157 gpg_err_init (libgpg-error.so.0 + 0x4157)
#8  0x00007fc176475216 n/a (ld-linux-x86-64.so.2 + 0x10216)
#9  0x00007fc176475318 n/a (ld-linux-x86-64.so.2 + 0x10318)
#10 0x00007fc17646609a n/a (ld-linux-x86-64.so.2 + 0x109a)

# equery u telegram-desktop jemalloc
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for net-im/telegram-desktop-2.8.11:
 U I
 + + X        : Add support for X11
 + + dbus     : Enable dbus support for anything that needs it (gpsd, gnomemeeting, etc)
 - - enchant  : Enable the app-text/aspell spell-checking backend 
 + + gtk      : Add support for x11-libs/gtk+ (The GIMP Toolkit)
 + + hunspell : Enable the app-text/hunspell spell-checking backend 
 + + spell    : Add dictionary support
 + + wayland  : Enable dev-libs/wayland backend
 - - webkit   : Add support for the WebKit HTML rendering/layout engine

 * Found these USE flags for dev-libs/jemalloc-5.2.1:
 U I
 + + abi_x86_32  : 32-bit (x86) libraries
 - - debug       : Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see
                   https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
 - - hardened    : Activate default security enhancements for toolchain (gcc, glibc, binutils)
 + + lazy-lock   : Enable lazy locking (only lock when multi-threaded) 
 - - prof        : Enable allocation profiling 
 - - static-libs : Build static versions of dynamic libraries as well
 - - stats       : Enable statistics calculation/reporting 
 + + xmalloc     : Add support for xmalloc (abort-on-out-of-memory)

# emerge --info =net-im/telegram-desktop-2.8.11
Portage 3.0.20 (python 3.9.5-final-0, default/linux/amd64/17.1/desktop/plasma/systemd, gcc-10.3.0, glibc-2.33-r1, 5.10.49-gentoo-r1 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.10.49-gentoo-r1-x86_64-AMD_Phenom-tm-_II_X6_1100T_Processor-with-glibc2.33
KiB Mem:    16133812 total,   5502100 free
KiB Swap:   12550140 total,   9056508 free
Timestamp of repository gentoo: Wed, 21 Jul 2021 06:45:01 +0000
Head commit of repository gentoo: c6b8c45ca17593b4ceee6e4b1ffd3e263bb4bd6c
sh dash 0.5.11.3-r1
ld GNU gold (Gentoo 2.35.2 p1 2.35.2) 1.16
distcc 3.4 x86_64-pc-linux-gnu [enabled]
ccache version 4.3 [disabled]
app-shells/bash:          5.1_p8::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.32.1::gentoo
dev-lang/python:          2.7.18_p11::gentoo, 3.9.5_p2::gentoo
dev-lang/rust:            1.52.1::gentoo
dev-util/ccache:          4.3::gentoo
dev-util/cmake:           3.18.5::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/sandbox:         2.24::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.3-r1::gentoo
sys-devel/binutils:       2.35.2::gentoo
sys-devel/gcc:            10.3.0-r2::gentoo
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.33-r1::gentoo
Repositories:

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

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

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -frecord-gcc-switches -march=amdfam10 -flto=6"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/easy-rsa /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="-O2 -pipe -frecord-gcc-switches -march=amdfam10 -flto=6"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going y --with-bdeps y"
ENV_UNSET="CARGO_HOME 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="-O2 -pipe -frecord-gcc-switches -march=amdfam10 -flto=6"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs cgroup compress-build-logs config-protect-if-modified distcc distlocks ebuild-locks ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-elog split-log strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -frecord-gcc-switches -march=amdfam10 -flto=6"
GENTOO_MIRRORS="http://mirror.leaseweb.com/gentoo/ http://mirror.init7.net/gentoo/ https://mirror.init7.net/gentoo/ http://ftp.uni-hannover.de/gentoo/"
LANG="it_IT.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--sort-common -flto=6"
LINGUAS="it it_IT"
MAKEOPTS="-j12 -l6"
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 aalib acl acpi activities adns alsa amd64 ao audiofile bash-completion bluetooth branding brotli bzip2 cairo caps cdda cddb cdparanoia cdr cli crypt css cups curl dbus declarative dga djvu dri dts dvd dvdr emboss encode exif expat fbcon ffmpeg fftw flac fontconfig fortran ftp gd gdbm geoip gif gimp gmp gnutls gphoto2 gpm graphviz gtk gui handbook iconv icu idn imagemagick imlib introspection ipv6 java javascript jbig jemalloc jpeg jpeg2k kde kipi kwallet lame lcms libass libglvnd libnotify libsamplerate libtirpc lm-sensors lua lzma lzo mad magic mmap mng mp3 mp4 mpeg mplayer multilib musicbrainz ncurses nls nptl nsplugin offensive ogg openal opengl openmp pam pango pch pcre pdf phonon plasma png policykit postscript ppds pulseaudio qml qt5 rdesktop readline recode samba sctp sdl seccomp sndfile sockets speex spell split-usr sqlite sqlite3 ssl startup-notification svg symlink syslog systemd sysvipc taglib telemetry test theora threads tidy tiff truetype udev udisks unicode upower usb v4l vaapi vala vdpau verify-sig vim-syntax vnc vorbis wavpack wayland webp widgets win32codecs wmf wxwidgets x264 xattr xcb xine xinerama xml xpm xscreensaver xv xvid yahoo zip zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="hda-intel virmidi" 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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="3dnow 3dnowext mmx mmxext popcnt sse sse2 sse3 sse4a" CURL_SSL="gnutls" 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" GRUB_PLATFORMS="pc" INPUT_DEVICES="libinput" KERNEL="linux" L10N="it en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="radeon r600" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto 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, RUSTFLAGS

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

net-im/telegram-desktop-2.8.11::gentoo was built with the following:
USE="X dbus gtk hunspell spell wayland -enchant -webkit" ABI_X86="(64)"
CFLAGS="-O2 -pipe -frecord-gcc-switches -march=amdfam10 -flto=6 -ggdb"
CXXFLAGS="-O2 -pipe -frecord-gcc-switches -march=amdfam10 -flto=6 -ggdb"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs cgroup compress-build-logs config-protect-if-modified distlocks ebuild-locks ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-elog split-log splitdebug strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"

Is there any more info I can give you?
Comment 1 Tee KOBAYASHI 2021-07-21 15:17:17 UTC
The symptom looks very similar to that of https://bugs.gentoo.org/802435.

I suspect this is due to dev-libs/jemalloc being merged with USE=lazy-lock (or possibly xmalloc).
Comment 2 Paolo Pedroni 2021-07-22 09:25:13 UTC
(In reply to Tee KOBAYASHI from comment #1)
> The symptom looks very similar to that of https://bugs.gentoo.org/802435.
> 
> I suspect this is due to dev-libs/jemalloc being merged with USE=lazy-lock
> (or possibly xmalloc).

That's it! Removing USE=lazy-lock and rebuilding jemalloc does the trick and telegram-desktop starts again.

Thanks.
Comment 3 Esteve Varela Colominas 2021-07-22 10:03:21 UTC
I have no idea what lazy-lock does, but the jemalloc reports sure keep on coming.
Is this something that can be solved from telegram-desktop's side at all? Or is this a bug with jemalloc itself? I'd prefer not restricting the use of certain USE flags from *DEPEND...

This is practically the only jemalloc-related code that tdesktop has: https://github.com/telegramdesktop/tdesktop/blob/3e8912a53f9a9d4313577a4bccdfbf77ff5c5d59/Telegram/SourceFiles/platform/linux/specific_linux.cpp#L643
Comment 4 Esteve Varela Colominas 2021-07-23 14:44:08 UTC
I've looked a bit more into this. Apparently lazy-lock attempts to override/intercept pthread_create, by using libdl to grab the "next" pthread_create symbol, storing it in pthread_create_fptr, and calling that from its overridden pthread_create. It does this to find out when the program is multithreading (hence lazily enabling mutex locking mechanisms).

Why dlsym() fails, and abort() is called as a consequence, I'm not sure, however. I doubt it's related to LTO, but that, and using mallctl to set the "lazy_lock" option to false from telegram-desktop (it has a fallback in that event), should both be attempted before it's written off as unsolveable.
Comment 5 Ilia Durov 2021-08-03 14:17:07 UTC
Maybe related bug:
https://bugs.gentoo.org/806292
Comment 6 Larry the Git Cow gentoo-dev 2021-08-04 08:31:25 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da5ba81dc4f99995d6687bede23bbcef9683e561

commit da5ba81dc4f99995d6687bede23bbcef9683e561
Author:     Esteve Varela Colominas <esteve.varela@gmail.com>
AuthorDate: 2021-08-03 21:14:56 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2021-08-04 08:29:27 +0000

    net-im/telegram-desktop: Enforce jemalloc with -lazy-lock for the time being
    
    Bug: https://bugs.gentoo.org/803233
    Signed-off-by: Esteve Varela Colominas <esteve.varela@gmail.com>
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 net-im/telegram-desktop/telegram-desktop-2.8.11.ebuild | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Comment 7 Esteve Varela Colominas 2021-09-11 19:56:22 UTC
Making the solution permanent unless someone's willing to make and test an alternative solution.
Comment 8 Larry the Git Cow gentoo-dev 2024-04-10 23:34:06 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a9e6c3310976482ab2d9c2bcba2c0a1100ce1f6a

commit a9e6c3310976482ab2d9c2bcba2c0a1100ce1f6a
Author:     Yixun Lan <dlan@gentoo.org>
AuthorDate: 2024-04-10 23:07:32 +0000
Commit:     Yixun Lan <dlan@gentoo.org>
CommitDate: 2024-04-10 23:33:23 +0000

    net-im/telegram-desktop: drop jemalloc[lazy-lock] restriction
    
    tested with jemalloc[lazy-lock], it works fine with 4.16.6, so drop it.
    
    Bug: https://bugs.gentoo.org/803233
    Signed-off-by: Yixun Lan <dlan@gentoo.org>

 net-im/telegram-desktop/telegram-desktop-4.16.6.ebuild | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)