Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

telegram-desktop crashes #32053

Closed
husio opened this issue Jul 20, 2021 · 24 comments
Closed

telegram-desktop crashes #32053

husio opened this issue Jul 20, 2021 · 24 comments

Comments

@husio
Copy link

husio commented Jul 20, 2021

After an upgrade of the telegram-desktop package, application is crashing just after starting (I can see the window blinking).

Suspected commit is 279e2e4

I am running musl version, source-revisions: telegram-desktop:279e2e42c2

% telegram-desktop 

(telegram-desktop:5619): Telegram-WARNING **: 13:29:32.291: Application was built without embedded fonts, this may lead to font issues.
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-piotr'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-piotr'
[ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted (1)
error: : cannot open
error: : cannot open
error: : cannot open
[1]    5619 abort      telegram-desktop
@ericonr
Copy link
Member

ericonr commented Jul 20, 2021

Please launch it under strace to figure out what it's failing to open.

@husio
Copy link
Author

husio commented Jul 20, 2021

This is weird, % strace telegram-desktop is successfully launching the application and I can use it without an issue. Running only % telegram-desktop is still crashing. How confusing.

% strace telegram-desktop 2> >( grep 'real-time' -B 3 -A 5 )
mmap(NULL, 2129920, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe00b772000
mprotect(0x7fe00b774000, 2121728, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [PIPE], 8) = 0
clone(child_stack=0x7fe00b974728, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|0x400000, parent_tid=[ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted[9325],  (1)
tls=0x7fe00b979b20, child_tidptr=0x7fe024a24204) = 9325
rt_sigprocmask(SIG_SETMASK, [PIPE], NULL, 8) = 0
futex(0x7fe0248dcf6c, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x7ffd60685244, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
getpid()                                = 9297

@ericonr
Copy link
Member

ericonr commented Jul 20, 2021

strace can sometimes serialize race conditions, if that's what's causing this.

@ericonr
Copy link
Member

ericonr commented Jul 20, 2021

FWIW it's working fine here. I will update the rest of desktop and try again.

@husio
Copy link
Author

husio commented Jul 20, 2021

I have found this issue in the telegram repository. Maybe it is worth using the old version for now?

telegramdesktop/tdesktop#16673

@ericonr
Copy link
Member

ericonr commented Jul 20, 2021

Are you using Xorg or Wayland?

I see these same errors:

[ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted (1)
error: : cannot open
error: : cannot open
error: : cannot open

but then things work just fine. But if it's smashing stack, it could be many different things, including system fonts being processed wrongly, so what fonts you have installed could make a difference, as could many other things.

If we can look at a backtrace via a core file or something, we might be able to see if the segfault is also musl detecting the stack smashing or something else.

@husio
Copy link
Author

husio commented Jul 20, 2021

I don't know why exactly, but I cannot create a core dump file.

% ls -l telegram-desktop 
-rwxrwxrwx 1 piotr piotr 66749648 Jul 20 21:06 telegram-desktop
% pwd
/tmp
% ulimit -c unlimited
% ./telegram-desktop 

(telegram-desktop:5391): Telegram-WARNING **: 21:08:07.261: Application was built without embedded fonts, this may lead to font issues.
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-piotr'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-piotr'
[ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted (1)
error: : cannot open
error: : cannot open
error: : cannot open
[1]    5391 abort (core dumped)  ./telegram-desktop

I am not very experienced with this, but from reading man 5 core I understand that there might be many reasons for why the core dump is not being created.

@ericonr
Copy link
Member

ericonr commented Jul 20, 2021

[1] 5391 abort (core dumped) ./telegram-desktop

It should be created... How are you checking for its presence? Do you have corecollector enabled shoveling core dumps elsewhere?

@krkk
Copy link
Contributor

krkk commented Jul 21, 2021

Could you try unset QT_QPA_PLATFORMTHEME and then run telegram? It fixed for me.

When I downgraded to the previous version (2.8.4), there was an message in my stdout, which explained to me why I previously had the default qt theme when selecting a file and why the newer version crashes:

Unfortunately, GTK integration conflicts with qgtk2 platformtheme and style. Therefore, QT_QPA_PLATFORMTHEME and QT_STYLE_OVERRIDE will be unset.
This can be ignored by setting DESKTOP_APP_I_KNOW_ABOUT_GTK_INCOMPATIBILITY environment variable to any value, however, if qgtk2 theme or style is used, this will lead to a crash.
GTK integration can be disabled by setting DESKTOP_APP_DISABLE_GTK_INTEGRATION to any value. Keep in mind that this will lead to some features being unavailable.

It looks like they removed the message and unsetting the enviroments in desktop-app/lib_base@f493a81#diff-5d8c1fecd0ee047b9263a26b184089db23769254a398648acc9a2078a58accbeL226-L227

@husio
Copy link
Author

husio commented Jul 21, 2021

It should be created... How are you checking for its presence? Do you have corecollector enabled shoveling core dumps elsewhere?

core file is not created. I do not know of any collector. I expect this is something I would have to enable via runit.

% ls /var/service | grep -v tty | xargs
acpid alsa bluetoothd dbus dhcpcd mpd openntpd udevd wpa_supplicant

Could you try unset QT_QPA_PLATFORMTHEME and then run telegram? It fixed for me.

That does not work for me.

% unset QT_QPA_PLATFORMTHEME
% telegram-desktop 

(telegram-desktop:2354): Telegram-WARNING **: 11:36:28.093: Application was built without embedded fonts, this may lead to font issues.
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-piotr'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-piotr'
[ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted (1)
error: : cannot open
error: : cannot open
error: : cannot open
[1]    2354 abort      telegram-desktop
% env | grep QT
% 

Maybe it really has to do something with fonts? Could you show me your list of installed fonts?

% xbps-query -l | grep font
ii SDL2_ttf-2.0.15_1                       Use TrueType fonts in your SDL 2.x applications
ii SDL2_ttf-devel-2.0.15_1                 Use TrueType fonts in your SDL 2.x applications - development files
ii dejavu-fonts-ttf-2.37_2                 DejaVu family of TrueType fonts
ii font-adobe-100dpi-1.0.3_7               Standard 100dpi Adobe PCF fonts
ii font-adobe-75dpi-1.0.3_7                Standard 75pi Adobe PCF fonts
ii font-adobe-utopia-100dpi-1.0.4_7        100dpi Adobe Utopia PCF fonts
ii font-adobe-utopia-75dpi-1.0.4_7         100dpi Adobe Utopia PCF fonts
ii font-adobe-utopia-type1-1.0.4_7         Adobe Utopia Type1 fonts
ii font-alias-1.0.4_2                      Standard aliases for X11 PCF fonts
ii font-bh-100dpi-1.0.3_6                  Standard 100dpi Bigelow and Holmes PCF fonts
ii font-bh-75dpi-1.0.3_6                   Standard 75dpi Bigelow and Holmes PCF fonts
ii font-bh-lucidatypewriter-100dpi-1.0.3_6 100dpi Bigelow and Holmes Lucida Typewriter PCF fonts
ii font-bh-lucidatypewriter-75dpi-1.0.3_6  75dpi Bigelow and Holmes Lucida Typewriter PCF fonts
ii font-bh-ttf-1.0.3_6                     Standard Bigelow and Holmes TrueType fonts
ii font-bh-type1-1.0.3_6                   Standard Bigelow and Holmes Type1 fonts
ii font-bitstream-100dpi-1.0.3_6           Standard 100dpi Bitstream PCF fonts
ii font-bitstream-75dpi-1.0.3_6            Standard 100dpi Bitstream PCF fonts
ii font-bitstream-type1-1.0.3_6            Standard Type1 Bitstream PCF fonts
ii font-cursor-misc-1.0.3_6                Standard X11 cursors in PCF format
ii font-daewoo-misc-1.0.3_6                Daewoo Gothic PCF format
ii font-dec-misc-1.0.3_6                   DEC cursor and session PCF fonts
ii font-ibm-type1-1.0.3_6                  IBM Courier Type1 fonts
ii font-isas-misc-1.0.3_6                  72dpi PCF versions of the Chinese Song Ti fonts
ii font-jis-misc-1.0.3_5                   78dpi PCF versions of the Japanese fixed fonts
ii font-misc-misc-1.1.2_7                  Standard X11 fixed PCF fonts
ii font-mutt-misc-1.0.3_6                  100dpi PCF versions of the ClearlyU fonts
ii font-util-1.3.2_1                       Tools for truncating and subseting of ISO10646-1 BDF fonts
ii fontconfig-2.13.1_3                     Library for configuring and customizing font access
ii fontconfig-devel-2.13.1_3               Library for configuring and customizing font access - development files
ii grub-terminus-0.3_1                     Terminus bold fonts for GRUB
ii gsfonts-8.11_7                          Ghostscript standard Type1 fonts
ii libXfont2-2.0.4_1                       X font 2 Library
ii libXfontcache-1.0.5_2                   X-TrueType font cache extension client library
ii libXft-2.3.3_1                          Library for configuring and customizing font access
ii libXft-devel-2.3.3_1                    Library for configuring and customizing font access - development files
ii libfontenc-1.1.4_1                      Fontenc Library from X.org
ii mkfontscale-1.2.1_2                     X11 Scalable Font Index Generator
ii terminus-font-4.49.1_1                  Clean, fixed width bitmap font
ii xlsfonts-1.0.6_1                        Server font list displayer for X
ii xorg-fonts-7.6_5                        Modular Xorg Fonts

@not-chicken
Copy link
Contributor

Hi @husio, could you paste output of ~/.local/share/TelegramDesktop/log.txt?

@husio
Copy link
Author

husio commented Jul 21, 2021

Hi @husio, could you paste output of ~/.local/share/TelegramDesktop/log.txt?

Sure, log.txt

Found all the core dumps as well! 😂

% ls ~/.local/share/TelegramDesktop 
core.3616  core.3796  core.3869  core.4452  core.5016  core.5119  core.5189  core.5329  core.5401  tdata
core.3715  core.3806  core.3879  core.5006  core.5109  core.5179  core.5267  core.5391  log.txt

I don't know how to analyze a core dump file properly, here is some random output:

Core was generated by `telegram-desktop'.
Program terminated with signal SIGABRT, Aborted.
#0  __restore_sigs (set=set@entry=0x7fff0e593c50) at ./arch/x86_64/syscall_arch.h:40
40      ./arch/x86_64/syscall_arch.h: No such file or directory.
[Current thread is 1 (LWP 4069)]
(gdb) bt
#0  __restore_sigs (set=set@entry=0x7fff0e593c50) at ./arch/x86_64/syscall_arch.h:40
#1  0x00007fb5f293c620 in raise (sig=sig@entry=6) at src/signal/raise.c:11
#2  0x00007fb5f2904e20 in abort () at src/exit/abort.c:13
#3  0x000056521793908f in ?? ()
#4  0x000056521751b915 in ?? ()
#5  0x0000565217932eac in ?? ()
#6  0x00007fb5eb3d9edb in ?? () from /lib/libgiomm-2.4.so.1
#7  0x00007fb5e8c585ab in ?? () from /lib/libgio-2.0.so.0
#8  0x00007fb5e8a1669f in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#9  0x00007fb5e8a16a48 in ?? () from /lib/libglib-2.0.so.0
#10 0x00007fb5e8a16aff in g_main_context_iteration () from /lib/libglib-2.0.so.0
#11 0x00007fb5ea25916f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/libQt5Core.so.5
#12 0x00007fb5ea200dcb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/libQt5Core.so.5
#13 0x00007fb5ea209050 in QCoreApplication::exec() () from /lib/libQt5Core.so.5
#14 0x0000565216cfc695 in ?? ()
#15 0x0000565216cf14d1 in ?? ()
#16 0x0000565216cf16d4 in ?? ()
#17 0x00005652161efff5 in ?? ()
#18 0x00007fb5f290470a in libc_start_main_stage2 (main=0x5652161effc0, argc=1, argv=0x7fff0e594818) at src/env/__libc_start_main.c:94
#19 0x00005652161faa1a in ?? ()
#20 0x0000000000000001 in ?? ()
#21 0x00007fff0e59662e in ?? ()
#22 0x0000000000000000 in ?? ()

@not-chicken
Copy link
Contributor

not-chicken commented Jul 21, 2021

I can also reproduce it locally(on musl +Xorg, but not on every try), backtrace with debugging symbols: https://pastebin.com/raw/HrS2efe4.
This assertion seems to be failing, checking via dbus-monitor it is indeed true on every attempt that result in crash.

@slotThe
Copy link
Contributor

slotThe commented Jul 22, 2021

Can also confirm that this has been biting me on musl+X11 with the same errors and backtraces that were already posted here

@ilya-fedin
Copy link

(i saw reference from this issue in tdesktop repo)

This assertion seems to be failing, checking via dbus-monitor it is indeed true on every attempt that result in crash.

The thing is, process of the service should exit with the main process, so it should always be false. Assertion violation is valid, such situation should never happen...

It looks like they removed the message and unsetting the enviroments in desktop-app/lib_base@f493a81#diff-5d8c1fecd0ee047b9263a26b184089db23769254a398648acc9a2078a58accbeL226-L227

Yeah, gtk usage was moved to separate processes, so this shouldn't be needed anymore.

@husio
Copy link
Author

husio commented Jul 26, 2021

For now, I have installed back old version (2.8.4_1.x86_64-musl) from the cache and locked telegram-desktop from upgrading. You can find the description of how to do this on void wiki.

This seems to be a cross-distribution issue. Although the telegram team seem to be in denial of a potential bug, it would be a big coincidence that all distributions are packaging the application wrong and only after an upgrade.

@ilya-fedin
Copy link

ilya-fedin commented Jul 26, 2021

your problem has nothing to do with that unconfirmed stack smashing issue

@Johnnynator
Copy link
Member

Can you test if this still happens with 2.9.
Also if it still happens can you give me some more information about your system (QT_ and GTK env vars, used Desktop Enviroment / Windows manager).

@husio
Copy link
Author

husio commented Aug 2, 2021

Yes, it is still crashing.

% xbps-query -s telegram
[*] telegram-desktop-2.8.10_1 Telegram Desktop messaging app
% env | grep -E '(GTK|QT)'
%

I am running musl, X11, i3. All in the latest available versions. What other information might be helpful?

I don't know if this is expected, but every time I downgrade telegram and run it, all configuration is gone, and I must configure it from scratch. As if the new crashing instance was first upgrading or deleting all configuration and older version was no longer able to read it.

@Kratacoa
Copy link

Can confirm that it is still the case with telegram-desktop-3.0.1_1 on musl (X11). Sometimes it doesn't crash, and other times it does, and when it does it usually stops working for the time being.

@Johnnynator
Copy link
Member

There is some race condition happening in the code path for loading the gtk libs when resizing it immediately after starting it (as will be done by i3 and other tiling manager).

You should be able to start it reliable by starting it in e.g. floating mode.

The offending code path is removed in Telegram 3.0.2.

@Johnnynator
Copy link
Member

Telegram 3.1.0 is in the repos now.
It should have the bug fixed (did only test it with the beta version 3.0.3), would be nice if someone could quickly verify if it is also fine for them now.

@slotThe
Copy link
Contributor

slotThe commented Sep 21, 2021 via email

@husio
Copy link
Author

husio commented Sep 28, 2021

I have upgraded to telegram-desktop-3.1.1_1 and the application is no longer crashing. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants