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

Bug 806486

Summary: net-im/telegram-desktop-2.8.11-r1 crashes when opening an embedded picture within a channel
Product: Gentoo Linux Reporter: Martin Erdtmann <martin.erdtmann>
Component: Current packagesAssignee: Esteve Varela Colominas <esteve.varela>
Status: RESOLVED FIXED    
Severity: normal CC: proxy-maint
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Disable jemalloc
emerge --info telegram-desktop

Description Martin Erdtmann 2021-08-05 07:52:11 UTC
When maximising a picture in a channel, telegram crashes and I can see this protection fault:

telegram-deskto[4253]: segfault at 8 ip 00007f569d6e5ee0 sp 00007ffe410fbcf8 error 4 in libQt5Gui.so.5.15.2[7f569d670000+367000]

A second attempt after relaunching telegram-desktop almost works and in most cases it does not fail in all further attempts. So it seems to work fine after one successful case

emerge --info

Portage 3.0.20 (python 3.9.6-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-10.3.0, glibc-2.33-r1, 5.10.52-gentoo x86_64)
=================================================================
System uname: Linux-5.10.52-gentoo-x86_64-AMD_FX-tm-8320_Eight-Core_Processor-with-glibc2.33
KiB Mem:    18338208 total,   4713336 free
KiB Swap:   20971516 total,  20971516 free
Timestamp of repository gentoo: Thu, 05 Aug 2021 07:00:01 +0000
Head commit of repository gentoo: 69ae39969075cf1bec2adfb4de44324b2e3dd8ce
Timestamp of repository poly-c: Wed, 04 Aug 2021 14:28:19 +0000
sh bash 5.1_p8
ld GNU ld (Gentoo 2.35.2 p1) 2.35.2
app-shells/bash:          5.1_p8::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.34.0::gentoo
dev-lang/python:          2.7.18_p11::gentoo, 3.9.6_p1::gentoo
dev-lang/rust:            1.53.0::gentoo
dev-util/cmake:           3.18.5::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1-r1::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.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 

crossdev
    location: /usr/local/portage-crossdev
    masters: gentoo
    priority: 10

poly-c
    location: /var/lib/layman/poly-c
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE RTCW-ETEULA Q3AEULA AdobeFlash-10.3 AdobeFlash-11.x PUEL google-talkplugin Google-TOS RAR FraunhoferFDK teamspeak3 MPEG-4 eternal_lands linux-firmware Lexmark NVIDIA-r2"
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/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="-march=native -O2 -pipe"
DISTDIR="/var/distfiles"
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"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/var/cache/binpkgs"
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 activities alsa amd64 apulse bluetooth branding bzip2 cairo cdda cdinstalli cdr cli crypt cups dbus declarative dri dts dvd dvdr elogind emboss encode exif ffmpeg flac fltk fortran freesound g3dvl gdbm gif gpm gt4 gtk gui iconv icu ipv6 jack jpeg kde kipi kwallet ladspa lcms libglvnd libnotify libsamplerate libtirpc lv2 mad midi mng mp3 mp4 mpeg mplayer multilib music ncurses nls nptl ogg opencl opengl openmp opus pam pango pcre pdf phonon plasma png policykit ppds qml qt5 readline scanner sddm sdl seccomp semantic-desktop sndfile snmp sound soundtouch spell split-usr ssl startup-notification svg taglib tcpd tiff timidity truetype udev udisks unicode upower usb v4l vaapi vdpau vorbis widgets wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="32 64" ADA_TARGET="gnat_2018" ALSA_CARDS="hda-intel hdsp ice1712" 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 f16c fma3 fma4 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 xop" 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="de 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="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26" SANE_BACKENDS="gt68xx genesys" USERLAND="GNU" VIDEO_CARDS="nvidia" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS


Reproducible: Sometimes

Steps to Reproduce:
1.Open telegram-desktop
2.Open a channel
3.click on a static picture (videos do not have this issue)
Actual Results:  
telegram-desktop crashes and has been closed

Expected Results:  
The picture will open with full size

It is strange that it looks like that it does not happen while my system is under heavy load e. g. an emerge process is running on all cores in the background. On a idleing system it failes at least more often.
Comment 1 Esteve Varela Colominas 2021-08-05 22:28:19 UTC
Thanks for reporting the issue!
However, I really hate to "works on my machine" but it really does, so to help figure out what's different about your setup, can you share your telegram use flags? (emerge --info telegram-desktop)
Also, to rule out any upstream issues, can you test the official binary? (https://updates.tdesktop.com/tlinux/tsetup.2.8.11.tar.xz)
If that doesn't work either, can you test 2.9.0?
If that *does* work, we'll have a very fun debugging session...
Comment 2 Martin Erdtmann 2021-08-06 05:17:39 UTC
Thanks for picking this up, I will keep you updated once something has changed.

"emerge --info telegram-desktop" tells me:

emerge --info telegram-desktop
Portage 3.0.20 (python 3.9.6-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-10.3.0, glibc-2.33-r1, 5.10.52-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.10.52-gentoo-x86_64-AMD_FX-tm-8320_Eight-Core_Processor-with-glibc2.33
KiB Mem:    18338208 total,  15453044 free
KiB Swap:   20971516 total,  20971516 free
Timestamp of repository gentoo: Thu, 05 Aug 2021 19:30:01 +0000
Head commit of repository gentoo: a8fa5fd7d0dd55197ac350a46fcce7be88c6f39e
Timestamp of repository poly-c: Thu, 05 Aug 2021 10:52:09 +0000
sh bash 5.1_p8
ld GNU ld (Gentoo 2.35.2 p1) 2.35.2
app-shells/bash:          5.1_p8::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.34.0::gentoo
dev-lang/python:          2.7.18_p11::gentoo, 3.9.6_p1::gentoo
dev-lang/rust:            1.53.0::gentoo
dev-util/cmake:           3.18.5::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1-r1::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.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1

crossdev
    location: /usr/local/portage-crossdev
    masters: gentoo
    priority: 10

poly-c
    location: /var/lib/layman/poly-c
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE RTCW-ETEULA Q3AEULA AdobeFlash-10.3 AdobeFlash-11.x PUEL google-talkplugin Google-TOS RAR FraunhoferFDK teamspeak3 MPEG-4 eternal_lands linux-firmware Lexmark NVIDIA-r2"
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/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="-march=native -O2 -pipe"
DISTDIR="/var/distfiles"
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"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/var/cache/binpkgs"
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 activities alsa amd64 apulse bluetooth branding bzip2 cairo cdda cdinstalli cdr cli crypt cups dbus declarative dri dts dvd dvdr elogind emboss encode exif ffmpeg flac fltk fortran freesound g3dvl gdbm gif gpm gt4 gtk gui iconv icu ipv6 jack jpeg kde kipi kwallet ladspa lcms libglvnd libnotify libsamplerate libtirpc lv2 mad midi mng mp3 mp4 mpeg mplayer multilib music ncurses nls nptl ogg opencl opengl openmp opus pam pango pcre pdf phonon plasma png policykit ppds qml qt5 readline scanner sddm sdl seccomp semantic-desktop sndfile snmp sound soundtouch spell split-usr ssl startup-notification svg taglib tcpd tiff timidity truetype udev udisks unicode upower usb v4l vaapi vdpau vorbis widgets wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="32 64" ADA_TARGET="gnat_2018" ALSA_CARDS="hda-intel hdsp ice1712" 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 f16c fma3 fma4 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 xop" 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="de 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="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26" SANE_BACKENDS="gt68xx genesys" USERLAND="GNU" VIDEO_CARDS="nvidia" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS

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

net-im/telegram-desktop-2.8.11-r1::gentoo was built with the following:
USE="X dbus gtk hunspell spell -enchant -wayland -webkit" ABI_X86="(64)"
Comment 3 Martin Erdtmann 2021-08-06 05:24:31 UTC
I have to admit, after two world updates I cannot recreate this issue anymore. I am sorry for the trouble but it was really existing also when I tried to unmask version 2.8.11-r1 in the past. But right now it looks like it was heen fixed for an unknown reason. Thanks for your support!
Comment 4 Esteve Varela Colominas 2021-08-06 09:48:35 UTC
No problem. It's good to get reports of even intermittent issues, as I have more information to work with in case someone reports it again, so thanks.
Feel free to reopen this bug report if you encounter the issue again.
Comment 5 Martin Erdtmann 2021-08-07 17:07:07 UTC
Unfortunately I is happening again. It seems to be that the probability is lower that before but the issue is not gone:

kernel: telegram-deskto[4255]: segfault at 7fe5906ce6a0 ip 00007fe5906ce6a0 sp 00007ffd8aadfac8 error 15

It was happening under the same circumstances then before.
Comment 6 Esteve Varela Colominas 2021-08-08 18:40:02 UTC
That's a shame to hear.
Can you try running the official binary (as linked before) or 2.9.0 for a while, and see if it's completely fixed with either of those?
This sounds like a race condition of some kind (especially given your mention that high system load "fixes" it), and debugging it will be a pain. Knowing at what address it crashes is kind of useless, but if neither of the above solve it, making a coredump after the crash and/or contacting upstream would be the next step...
Comment 7 Martin Erdtmann 2021-08-08 19:01:11 UTC
I will try version 2.9. BTW: I will be on vacation for the next week.
Comment 8 Martin Erdtmann 2021-08-09 05:12:15 UTC
Now testing 2.9, it looks good so far. Give it some time to verify that the crashes are gone.
Comment 9 Esteve Varela Colominas 2021-08-09 11:16:33 UTC
Thanks for testing, but I'll give it a bit before declaring victory. Also, can you share your jemalloc USE flags and CFLAGS? My jemalloc currently has no USE flags enabled, so maybe that's the issue.
I found an issue on the github that might be related: https://github.com/telegramdesktop/tdesktop/issues/16673 Do you think it's the same as yours?
Also don't worry about it, if you're not available to test, I'm willing to wait.
Comment 10 Esteve Varela Colominas 2021-08-09 11:32:41 UTC
Created attachment 731812 [details, diff]
Disable jemalloc

Also in case the issue still happens, it might be worthwhile to try the patch I've just attached. Copy it to /etc/portage/patches/net-im/telegram-desktop.
Using jemalloc prevents telegram from allocating more memory than it really needs, which for some reason seems to be an issue with the glibc allocator, so you might see higher memory usage.
Comment 11 Esteve Varela Colominas 2021-08-10 18:16:10 UTC
Sorry for pinging this thread, but for anyone having this issue, it'd be nice if they could post the ~/.local/share/TelegramDesktop/log.txt after the crash.
Comment 12 Martin Erdtmann 2021-08-14 10:42:13 UTC
I am now running Version 2.9 and it seems to work flawless. 
Nevertheless, if you like me to do so, I will go back to net-im/telegram-desktop-2.8.11-r2, which became stable in the meantime.

Regarding the bug "stack smashing detected" - it does not seem to do with that since I never saw this string in my syslog after the crashes.
Comment 13 Esteve Varela Colominas 2021-08-14 11:41:55 UTC
I see. The stack smashing detected thing depends on your compiler settings, such as GCC's USE=ssp, I'm sure some distros have even stricter defaults where this may trip over just a regular segfault, so I'm not sure it's something different.
2.8.11-r2 is mostly a change in ebuild dependencies, I highly doubt it fixes this issue, so don't bother. Since I have no methods of reproducing this intermittent issue, I'll assume this issue is fixed when >=2.9.0 is stabilized, unless it starts happening again to you or someone else.
Comment 14 Martin Erdtmann 2021-08-14 11:48:26 UTC
I was too fast - just right now I got a crash under the same circumstances:

Aug 14 13:43:49 kellerkind kernel: traps: telegram-deskto[4301] general protection fault ip:7f9f624f576c sp:7ffeb9e4f380 error:0 in libQt5Gui.so.5.15.2[7f9f621f8000+367000]

But it´s likely not happen very often. It will be difficult to find the root cause unless I will install a debug version and write dumps. Unfortunaltly I amd to very experienced in these stuff. My dev experience is more or less python based.
Comment 15 Martin Erdtmann 2021-08-14 13:36:28 UTC
Now it happened when opening a video, too. Therefore I will not apply your patch and check this out.
Comment 16 Martin Erdtmann 2021-08-14 13:40:34 UTC
Beside this, I will update to 2.9.3. I just saw that my current version was not in  portage anymore.
Comment 17 Martin Erdtmann 2021-08-14 14:07:33 UTC
I will post log.txt the next time, sorry I just forgot it and telgram seems to overwrite it once launched again.
Comment 18 Martin Erdtmann 2021-08-15 09:11:16 UTC
These are the last lines I got from my recent crash:

[2021.08.15 09:24:53] RPC Error: request 24 got fail with code 400, error CHAT_ADMIN_REQUIRED
[2021.08.15 09:25:03] Audio Info: recreating audio device and reattaching the tracks
[2021.08.15 09:25:06] OpenGL: [TRUE] (PipPanel)
[2021.08.15 09:25:19] Audio Info: Closing audio playback device.
[2021.08.15 09:25:48] Audio Info: recreating audio device and reattaching the tracks
[2021.08.15 09:25:48] OpenGL Profile: None.
[2021.08.15 09:25:48] OpenGL: [FALSE] (PipPanel)
[2021.08.15 09:26:04] Audio Info: Closing audio playback device.
[2021.08.15 09:26:23] RPC Error: request 120 got fail with code 400, error CHAT_ADMIN_REQUIRED
[2021.08.15 09:26:29] RPC Error: request 128 got fail with code 400, error CHAT_ADMIN_REQUIRED
[2021.08.15 09:41:09] Audio Info: recreating audio device and reattaching the tracks
[2021.08.15 09:41:11] Audio Info: Closing audio playback device.
[2021.08.15 09:54:56] RPC Error: request 149 got fail with code 400, error CHAT_ADMIN_REQUIRED
[2021.08.15 09:55:58] RPC Error: request 172 got fail with code 400, error CHAT_ADMIN_REQUIRED
[2021.08.15 10:13:27] API Warning: not loaded minimal channel applied.
[2021.08.15 10:21:58] API Warning: not loaded minimal channel applied.
[2021.08.15 10:21:58] API Warning: not loaded minimal channel applied.
[2021.08.15 10:21:58] API Warning: not loaded minimal channel applied.
[2021.08.15 10:21:58] API Warning: not loaded minimal channel applied.
[2021.08.15 10:21:58] API Warning: not loaded minimal channel applied.
[2021.08.15 10:38:04] Audio Info: recreating audio device and reattaching the tracks
[2021.08.15 10:38:06] Audio Info: Closing audio playback device.
[2021.08.15 10:50:17] Audio Info: recreating audio device and reattaching the tracks
[2021.08.15 10:50:19] Audio Info: Closing audio playback device.
[2021.08.15 10:54:43] RPC Error: request 193 got fail with code 400, error CHAT_ADMIN_REQUIRED
[2021.08.15 10:55:03] RPC Error: request 204 got fail with code 400, error CHAT_ADMIN_REQUIRED
[2021.08.15 10:55:11] RPC Error: request 215 got fail with code 400, error CHAT_ADMIN_REQUIRED
[2021.08.15 10:55:13] Audio Info: recreating audio device and reattaching the tracks
[2021.08.15 10:55:13] OpenGL: [TRUE] (PipPanel)
[2021.08.15 10:55:22] Audio Info: Closing audio playback device.


I don´t see anything significant, unfortunatly.
Comment 19 Esteve Varela Colominas 2021-08-15 12:27:19 UTC
Shame. Can you try either the jemalloc patch I posted earlier, or as has been mentioned recently in the github thread, build either jemalloc or telegram (or both) with -O3 instead of -O2?
Comment 20 Esteve Varela Colominas 2021-08-15 12:28:29 UTC
Disregard the -O3 thing. Please test the patch if possible.
Comment 21 Martin Erdtmann 2021-08-15 12:30:45 UTC
I tested 2.6.3 with the patch and I got the crash, afterthat I recompiled 2.6.3 without the patch because I thought the patch is not fixing the problem. If you like I can build it again with the patch. Should I do that?
Comment 22 Esteve Varela Colominas 2021-08-15 13:10:48 UTC
I see. Nevermind the patch, then.

In that case the last thing I can ask of you is a coredump. Build jemalloc, tg_owt and telegram-desktop with FEATURES=nostrip and C(XX)FLAGS=-ggdb as described in https://wiki.gentoo.org/wiki/Debugging
And then run telegram like this:
    sudo sysctl -w kernel.core_pattern=core
    ulimit -c unlimited
    telegram-desktop

If it crashes, it will say (core dumped), and it will store a dump at ~/.local/share/TelegramDesktop/core. Generate a backtrace with sys-devel/gdb like this:
    gdb telegram-desktop ~/.local/share/TelegramDesktop/core
    bt

There's more info that can be gathered from a coredump, but without additional context I wouldn't know what to look for, and inspecting it myself would require getting a copy of your binaries along with the coredump... Here's hoping the backtrace is enough.
Comment 23 Esteve Varela Colominas 2021-08-15 13:25:17 UTC
Also please enable the "debugmode" cheatcode as described here: https://github.com/telegramdesktop/tdesktop/issues/16540#issuecomment-872079690
This will give more detail on log.txt...

Sorry for asking so many things, and thank you for your patience...
Comment 24 Martin Erdtmann 2021-08-15 13:45:01 UTC
Just to be clear, I need to place a file like this:
/etc/portage/package.env/dev-libs/jemalloc

containing this:
nostrip C(XX)FLAGS=-ggdb

and the same way for tg_owt and telegram-desktop, correct?
Comment 25 Martin Erdtmann 2021-08-15 13:52:07 UTC
Correction, it must be:
FEATURES="${FEATURES} nostrip C(XX)FLAGS=-ggdb

right?
Comment 26 Esteve Varela Colominas 2021-08-15 14:01:29 UTC
Your file in /etc/portage/env must contain, exactly:
    FEATURES="nostrip"
    CFLAGS="${CFLAGS} -ggdb"
    CXXFLAGS"${CXXFLAGS} -ggdb"
Comment 27 Martin Erdtmann 2021-08-15 14:07:20 UTC
you mean /etc/portage/package.env/<package specific path> 

and NOT just /etc/portage/env   ?
Comment 28 Martin Erdtmann 2021-08-15 14:13:10 UTC
It seems to be that I am on the wrong way:
emerge -a1 jemalloc tg_owt telegram-desktop
--- Invalid atom in /etc/portage/package.env/dev-libs/jemalloc: FEATURES="nostrip"
--- Invalid atom in /etc/portage/package.env/dev-libs/jemalloc: CFLAGS="${CFLAGS}
--- Invalid atom in /etc/portage/package.env/dev-libs/jemalloc: CXXFLAGS"${CXXFLAGS}
--- Invalid atom in /etc/portage/package.env/media-libs/tg_owt: FEATURES="nostrip"
--- Invalid atom in /etc/portage/package.env/media-libs/tg_owt: CFLAGS="${CFLAGS}
--- Invalid atom in /etc/portage/package.env/media-libs/tg_owt: CXXFLAGS"${CXXFLAGS}
--- Invalid atom in /etc/portage/package.env/net-im/telegram-desktop: FEATURES="nostrip"
--- Invalid atom in /etc/portage/package.env/net-im/telegram-desktop: CFLAGS="${CFLAGS}
--- Invalid atom in /etc/portage/package.env/net-im/telegram-desktop: CXXFLAGS"${CXXFLAGS}
Comment 29 Esteve Varela Colominas 2021-08-15 14:22:14 UTC
The filename should be either /etc/portage/env/<file> or /etc/portage/env/<cat>/<pkg>
The former can be used from package.env, to specify the same file for multiple packages.
See: https://wiki.gentoo.org/wiki//etc/portage/package.env
Comment 30 Martin Erdtmann 2021-08-15 14:24:00 UTC
Understood, it must be /etc/portage/env/<package path>
the wikipage was confusing me, sorry  ..

I am now building, this will take a while.
Comment 31 Martin Erdtmann 2021-08-15 14:55:25 UTC
According to the wiki, do I need the files "debugsyms" and "installsources" as well?
Comment 32 Esteve Varela Colominas 2021-08-15 15:15:21 UTC
Just nostrip is fine. "debugsyms" doesn't exist and "splitdebug" is just a fancier nostrip. "installdebug" allows stepping through the source code but isn't necessary for a backtrace.
Comment 33 Esteve Varela Colominas 2021-08-15 15:15:50 UTC
> installdebug

I meant installsources...
Comment 34 Martin Erdtmann 2021-08-15 15:35:43 UTC
It´s all build, debugmode switched on and I am now waiting for the next crash .. let´s see ;)
Comment 35 Martin Erdtmann 2021-08-15 15:56:05 UTC
Hnn .. the "nostrip" does not seem to be enabled, gdb tells me:

###### gdp output #######
gdb telegram-desktop ~/.local/share/TelegramDesktop/core 
GNU gdb (Gentoo 10.2 vanilla) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from telegram-desktop...
(No debugging symbols found in telegram-desktop)

warning: Can't open file /memfd:/.glXXXXXX (deleted) during file-backed mapping note processing

warning: Can't open file /memfd:xorg (deleted) during file-backed mapping note processing

warning: Can't open file /memfd:/.nvidia_drv.XXXXXX (deleted) during file-backed mapping note processing

warning: core file may not match specified executable file.
[New LWP 2619]
[New LWP 2629]
[New LWP 2652]
[New LWP 2621]
[New LWP 2622]
[New LWP 2624]
[New LWP 2651]
[New LWP 2650]
[New LWP 2656]
[New LWP 2620]
[New LWP 2809]
[New LWP 2666]
[New LWP 4863]
[New LWP 2623]
[New LWP 2833]
[New LWP 4855]
[New LWP 5107]
[New LWP 4854]
[New LWP 2635]
[New LWP 4856]
[New LWP 4857]
[New LWP 4862]
[New LWP 5110]
[New LWP 5104]
[New LWP 5103]
[New LWP 4861]
[New LWP 2630]
[New LWP 2636]
[New LWP 4924]
[New LWP 5111]
[New LWP 5109]
[New LWP 4864]
[New LWP 5108]
[New LWP 2649]
[New LWP 2648]
[New LWP 5105]
[New LWP 5106]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
--Type <RET> for more, q to quit, c to continue without paging--c
Core was generated by `telegram-desktop'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f8374f1067c in QOpenGL2PaintEngineEx::end() () from /usr/lib64/libQt5Gui.so.5
####### end gdp output #######

I am sorry but I guess I missed something. Let me doublecheck the files.
Comment 36 Esteve Varela Colominas 2021-08-15 16:05:06 UTC
You can use emerge --info to verify the correct FEATURES flag was set.
Comment 37 Martin Erdtmann 2021-08-15 16:06:14 UTC
Possibly this is the cause:

Installing (3 of 3) net-im/telegram-desktop-2.9.3::gentoo
/etc/portage/env/net-im/telegram-desktop: line 4: CXXFLAGS-march=native -O2 -pipe -ggdb: command not found
Comment 38 Esteve Varela Colominas 2021-08-15 17:34:11 UTC
You forgot the = sign.
    CXXFLAGS="${CXXFLAGS} -ggdb"

You can also use emerge --info to check if a package was merged with the correct flags/features.
Comment 39 Martin Erdtmann 2021-08-16 08:29:13 UTC
emerge --info telegram-desktop:

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

net-im/telegram-desktop-2.9.3::gentoo was built with the following:
USE="X dbus gtk hunspell spell -enchant -screencast -wayland -webkit" ABI_X86="(64)"
CFLAGS="-march=native -O2 -pipe -ggdb -ggdb -ggdb -ggdb -ggdb -ggdb -ggdb"
CXXFLAGS="-march=native -O2 -pipe -ggdb -ggdb -ggdb -ggdb -ggdb -ggdb -ggdb"
FEATURES="nostrip"

I am now waiting for the next crash, but it don´t know where there multiple  "-ggdp" parameters come from, nevertheless I guess it will not hurt because the compiler just ignores redundant parameters.

Sorry for bothering you with these stuff, this is the first time for me doing this  stuff - but a good exercise and I gain experience, thanks for that!
Comment 40 Martin Erdtmann 2021-08-16 09:56:20 UTC
Result
1. Error log

martin@kellerkind ~ $ gdb telegram-desktop ~/.local/share/TelegramDesktop/core > ~/Desktop/tdesktop.trace

warning: Can't open file /memfd:/.glXXXXXX (deleted) during file-backed mapping note processing

warning: Can't open file /memfd:xorg (deleted) during file-backed mapping note processing

warning: Can't open file /memfd:/.nvidia_drv.XXXXXX (deleted) during file-backed mapping note processing

warning: Can't open file /usr/lib64/libbsd.so.0.10.0 (deleted) during file-backed mapping note processing

warning: core file may not match specified executable file.

warning: .dynamic section for "/usr/lib64/libbsd.so.0" is not at the expected address (wrong library or version mismatch?)

2. Stdout

GNU gdb (Gentoo 10.2 vanilla) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from telegram-desktop...
[New LWP 11138]
[New LWP 11139]
[New LWP 11148]
[New LWP 11196]
[New LWP 11171]
[New LWP 11142]
[New LWP 11140]
[New LWP 11141]
[New LWP 11769]
[New LWP 11149]
[New LWP 11770]
[New LWP 11154]
[New LWP 11143]
[New LWP 11776]
[New LWP 11169]
[New LWP 11170]
[New LWP 11199]
[New LWP 22820]
[New LWP 22809]
[New LWP 11178]
[New LWP 11155]
[New LWP 22802]
[New LWP 11270]
[New LWP 11172]
[New LWP 11360]
[New LWP 11774]
[New LWP 11771]
[New LWP 22803]
[New LWP 11777]
[New LWP 11173]
[New LWP 12329]
[New LWP 22816]
[New LWP 11772]
[New LWP 22805]
[New LWP 11779]
[New LWP 22807]
[New LWP 22817]
[New LWP 22804]
[New LWP 31398]
[New LWP 11775]
[New LWP 22815]
[New LWP 22806]
[New LWP 22812]
[New LWP 11773]
[New LWP 22818]
[New LWP 11778]
[New LWP 22819]
[New LWP 22813]
[New LWP 22814]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `telegram-desktop'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000000000 in ?? ()
[Current thread is 1 (Thread 0x7fc47f17e5c0 (LWP 11138))]
[?2004h(gdb) 

######################

Seems not to be much information, did I something wrong?
Comment 41 Esteve Varela Colominas 2021-08-16 12:38:04 UTC
You forgot to run the bt/backtrace command within gdb.
Comment 42 Martin Erdtmann 2021-08-16 13:02:55 UTC
I get the same result  with this additional line:

"Excess command line arguments ignored. (bt)"

so gdb does not know the parameter called "bt". "backtrace" does not work either.
Comment 43 Martin Erdtmann 2021-08-16 13:06:17 UTC
Ahhh, sorry, understood I need to execute it afterwards within the gdb commandline. Sorry this was not clear for me. Will update soon
Comment 44 Martin Erdtmann 2021-08-16 13:08:39 UTC
--Type <RET> for more, q to quit, c to continue without paging--
Core was generated by `telegram-desktop'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000000000 in ?? ()
[Current thread is 1 (Thread 0x7fc47f17e5c0 (LWP 11138))]
(gdb) bt
#0  0x0000000000000000 in  ()
#1  0x00007fc47e398682 in QOpenGL2PaintEngineEx::end() () at /usr/lib64/libQt5Gui.so.5
#2  0x000055ed22ae6b5e in Ui::GL::(anonymous namespace)::SurfaceOpenGL::paintEvent(QPaintEvent*)
    (this=0x7fc457330f00, e=<optimized out>)
    at /var/tmp/portage/net-im/telegram-desktop-2.9.3/work/tdesktop-2.9.3-full/Telegram/lib_ui/ui/gl/gl_surface.cpp:102
#3  0x00007fc47e6ba0be in QWidget::event(QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#4  0x000055ed22bc039d in Ui::RpWidgetWrap::handleEvent(QEvent*) (this=0x7fc457330f30, event=0x7fffce900f10)
    at /var/tmp/portage/net-im/telegram-desktop-2.9.3/work/tdesktop-2.9.3-full/Telegram/lib_ui/ui/rp_widget.cpp:161
#5  0x00007fc47e67aedf in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#6  0x000055ed21dc884e in Core::Sandbox::notify(QObject*, QEvent*)
    (this=0x7fffce901940, receiver=0x7fc457330f00, e=0x7fffce900f10)
    at /var/tmp/portage/net-im/telegram-desktop-2.9.3/work/tdesktop-2.9.3-full/Telegram/SourceFiles/core/sandbox.cpp:550
#7  0x00007fc47dc4a940 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#8  0x00007fc47e6b22e6 in QWidgetPrivate::sendPaintEvent(QRegion const&) () at /usr/lib64/libQt5Widgets.so.5
#9  0x00007fc47e68b5c5 in  () at /usr/lib64/libQt5Widgets.so.5
#10 0x00007fc47e68babb in  () at /usr/lib64/libQt5Widgets.so.5
#11 0x00007fc47e6d508f in  () at /usr/lib64/libQt5Widgets.so.5
#12 0x00007fc47e67aedf in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#13 0x000055ed21dc884e in Core::Sandbox::notify(QObject*, QEvent*)
    (this=0x7fffce901940, receiver=0x7fc45fc2c2e0, e=0x7fffce901410)
    at /var/tmp/portage/net-im/telegram-desktop-2.9.3/work/tdesktop-2.9.3-full/Telegram/SourceFiles/core/sandbox.cpp:550
#14 0x00007fc47dc4a940 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#15 0x00007fc47e0b4771 in QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*) ()
    at /usr/lib64/libQt5Gui.so.5
#16 0x00007fc47e0943bb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib64/libQt5Gui.so.5
#17 0x00007fc476f23b2a in  () at /usr/lib64/libQt5XcbQpa.so.5
#18 0x00007fc47f09a4ea in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
#19 0x00007fc47f09a780 in  () at /usr/lib64/libglib-2.0.so.0
#20 0x00007fc47f09a82f in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#21 0x00007fc47dc94d8f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib64/libQt5Core.so.5
#22 0x00007fc47dc49493 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#23 0x00007fc47dc50c6d in QCoreApplication::exec() () at /usr/lib64/libQt5Core.so.5
#24 0x000055ed21dc74e3 in Core::Sandbox::start() (this=this@entry=0x7fffce901940)
    at /var/tmp/portage/net-im/telegram-desktop-2.9.3/work/tdesktop-2.9.3-full/Telegram/SourceFiles/core/sandbox.cpp:157
#25 0x000055ed21db9680 in Core::Launcher::executeApplication() (this=0x7fffce9018d0)
    at /var/tmp/portage/net-im/telegram-desktop-2.9.3/work/tdesktop-2.9.3-full/Telegram/SourceFiles/core/launcher.cpp:533
#26 0x000055ed21db97e0 in Core::Launcher::exec() (this=0x7fc478483f60)
    at /var/tmp/portage/net-im/telegram-desktop-2.9.3/work/tdesktop-2.9.3-full/Telegram/SourceFiles/core/launcher.cpp:337
#27 0x000055ed2127bef5 in main(int, char**) (argc=<optimized out>, argv=<optimized out>)
    at /var/tmp/portage/net-im/telegram-desktop-2.9.3/work/tdesktop-2.9.3-full/Telegram/SourceFiles/main.cpp:12
(gdb)
Comment 45 Esteve Varela Colominas 2021-08-16 13:32:29 UTC
Thanks a ton! This seems like an opengl-related bug within telegram. Upstream has a bug report that's very likely related: https://github.com/telegramdesktop/tdesktop/issues/16540
I'll forward the backtrace along to upstream as it'll probably be helpful, and I'm currently not near my computer to check it out myself. Please keep the coredump (and unstripped binaries) around as it might be useful for further information gathering.
Could you mention your current graphics driver (VIDEO_CARDS variable or installed xf86-video-* packages) and version?
Comment 46 Esteve Varela Colominas 2021-08-16 13:34:40 UTC
Also, to prevent crashing, you can disable opengl in settings->advanced->performance as a temporary fix.
Comment 47 Martin Erdtmann 2021-08-16 13:55:46 UTC
VIDEO_CARDS="nvidia"
x11-drivers/nvidia-drivers-470.57.02  (it was 460.91.03 the last days, just updated)

And thank you for you patience with the mistakes of an unexperienced N00b ;) And thank you for picking up this issue at all.
Comment 48 Esteve Varela Colominas 2021-08-17 15:04:30 UTC
Alright, thanks for everything. Unfortunately what I can do to help pretty much ends here. Upstream is aware of the issue now but doesn't know either - they suspect it's either related to the graphics driver or Qt. It might help to generate a backtrace with the debugging symbols for dev-qt/qtgui enabled, but no promises there either. If it's truly a Qt issue, it might be more helpful to wait for the gentoo:kde devs to package the kde patchset for Qt, as that might fix it.

In the meantime, the workaround remains: to turn off opengl rendering under settings->advanced->performance.
Comment 49 Martin Erdtmann 2022-04-08 17:04:37 UTC
This issues is fixed with newer versions since a certain amount of time.
Comment 50 Esteve Varela Colominas 2022-04-08 20:26:03 UTC
Thanks for confirming!
Comment 51 Росен Александров 2022-12-18 15:23:56 UTC
Created attachment 843447 [details]
emerge --info telegram-desktop