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

High CPU usage out of nowhere #23899

Closed
SinTan1729 opened this issue Jan 15, 2022 · 35 comments
Closed

High CPU usage out of nowhere #23899

SinTan1729 opened this issue Jan 15, 2022 · 35 comments

Comments

@SinTan1729
Copy link

SinTan1729 commented Jan 15, 2022

Steps to reproduce

  1. Just keep the app running in the background.

Expected behaviour

It should work with normal usage (1-2% in background will be expected).

Actual behaviour

Randomly starts using tons of CPU.

Operating system

EndeavourOS KDE, also happened in Manjaro KDE

Version of Telegram Desktop

3.4.3-2

Installation source

Other (unofficial) source

Logs

No response

Screenshot

image

@SinTan1729 SinTan1729 added the bug label Jan 15, 2022
@ghost
Copy link

ghost commented Mar 23, 2022

I'm experiencing the same issue on Manjaro KDE using Telegram Desktop 3.6.1

@top4ek
Copy link

top4ek commented Apr 11, 2022

3.6.1, Archlinux, KDE — the same.
Screenshot_20220411_102801

@IgnatBeresnev
Copy link

Started happening randomly on 3.6.1 as well, didn't experience it before.

Killing telegram-desktop and opening it again helps

Arch, i3, X11

@simoneruffini
Copy link

simoneruffini commented Jun 6, 2022

I have this issue too, 20% usage even when in background and with no audio/video/gif playing.

My version is the 3.6 from nix (package telegram-desktop) on wayland (sway) with the following env variables:

export QT_QPA_PLATFORM="wayland"
export QT_WAYLAND_FORCE_DPI="physical"
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"

My only suspect is this line
[2022.06.06 23:30:45] Native Notification Error: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
that gets logged with a high frequency in .local/share/TelegramDesktop/log.txt
I'm not sure but could it be something to do with gnome-keyrings?

@pmoieni
Copy link

pmoieni commented Jul 14, 2022

Same issue. version 4.0.2 on Fedora KDE.
image
and the process doesn't finish when I fully close the telegram. I need to manually quit the process from the system monitor.

@pmoieni
Copy link

pmoieni commented Jul 15, 2022

I enabled use system window frame in settings and looks like the issue is fixed. on default setting I was getting the application launch bouncing feedback (which KDE shows next to the pointer when an application is launching) on every click.

Edit: nope. it just took longer to reach that level. still high cpu usage.

@ghost
Copy link

ghost commented Aug 6, 2022

same issue, it's annoying

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Aug 8, 2022

If you're using Fedora, switch to the official binary provided by https://desktop.telegram.org. Third-party builds frequently use wrong library versions that lead to instability and various bugs. This is especially known to happen on a regular basis with the package provided by the Fedora community.

@pmoieni
Copy link

pmoieni commented Aug 8, 2022

@ilya-fedin switched to flatpak version and haven't seen the issue for a long time. Thanks.

@simoneruffini
Copy link

If you're using Fedora, switch to the official binary provided by https://desktop.telegram.org. Third-party builds frequently use wrong library versions that lead to instability and various bugs. This is especially known to happen on a regular basis with the package provided by the Fedora community.

Can you share which are the correct libraries to build upon?

@ilya-fedin
Copy link
Contributor

Can you share which are the correct libraries to build upon?

The correct library version to avoid this bug is ffmpeg 4.4.

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Aug 10, 2022

Is there anyone who can confirm high CPU usage with official binary? If not, this is going to be closed as a 3rd party builds bug.

@ohhai
Copy link

ohhai commented Aug 12, 2022

@ilya-fedin

If you're using Fedora, switch to the official binary provided by https://desktop.telegram.org. Third-party builds frequently use wrong library versions that lead to instability and various bugs. This is especially known to happen on a regular basis with the package provided by the Fedora community.

I see that Fedora uses ffmpeg 5.0.1, which is official stable release: https://ffmpeg.org/download.html#releases
Does it have specific bugs? Or why it's wrong?

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Aug 13, 2022

Or why it's wrong?

No one ported tdesktop to ffmpeg 5.x. There was a big API break, so apparently tdesktop's usage of ffmpeg APIs is no longer valid (even though it compiles with ffmpeg 5.x). They should either build with the supported version or put the effort to port tdesktop to ffmpeg 5.x.

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Aug 13, 2022

The same with OpenSSL 3.x. tdesktop builds, but e.g. voice/video chats don't work.

@xvitaly
Copy link
Contributor

xvitaly commented Aug 13, 2022

Third-party builds frequently use wrong library versions that lead to instability and various bugs. This is especially known to happen on a regular basis with the package provided by the Fedora community.

If you don't want to fix bugs, close issue, but stop blaming innocent people.

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Aug 13, 2022

stop blaming innocent people

Innocent? Fedora and Arch are the leaders by amount of various packaging issues reported here. With the only difference that Arch usually applies the recommended fix while Fedora problems continue happen as they like to patch the build and over-engineering problems due to the church. Then they complain about problems they created on their own that could be avoided just by doing what's recommended by upstream.

Even Gentoo package got a good maintainer when the previous one stepped down due to having little free time. Still, Fedora package seem to continue getting into troubles.

@leigh123linux
Copy link

Or why it's wrong?

No one ported tdesktop to ffmpeg 5.x. There was a big API break, so apparently tdesktop's usage of ffmpeg APIs is no longer valid (even though it compiles with ffmpeg 5.x). They should either build with the supported version or put the effort to port tdesktop to ffmpeg 5.x.

Fuck it, time to move on to Whatsapp and get away from the bullshit excuses.

@ilya-fedin
Copy link
Contributor

Folks, it's called 'technical details', not 'excuses'. If you don't want to hear 'excuses', use the support, not GitHub.

@xvitaly
Copy link
Contributor

xvitaly commented Aug 13, 2022

With the only difference that Arch usually applies the recommended fix while Fedora problems continue happen as they like to patch the build and over-engineering problems due to the church.

Do you have proof of your words? I see that both Arch and Gentoo uses packaged Qt 6 and all other libraries, just like Fedora. Once they get ffmpeg 5 they will have the same issues.

Arch uses compatibility version of ffmpeg4.4.

as they like to patch the build

Btw, Fedora build has 0 downstream patches.

Then they complain about problems they created on their own that could be avoided just by doing what's recommended by upstream.

Fedora is a bleeding edge distribution. That's why we always have the latest versions of compilers and libraries.

@ilya-fedin
Copy link
Contributor

Do you have proof of your words?

The most long-standing issue with Fedora package is it's built with non-recommended build flags, e.g. GTK integration was disabled right until its deletion what was causing issues with clipboard and etc.

Btw, Fedora build has 0 downstream patches.

Nice to see

Arch uses compatibility version of ffmpeg4.4.

Yeah. As you can see, Arch already fixed this problem. I don't know what Gentoo will do when they get ffmpeg 5, but I believe they will do something instead of complaining.

Fedora is a bleeding edge distribution. That's why we always have the latest versions of compilers and libraries.

Fedora shouldn't remove old version of packages if some packages still depend on them. Even Arch still has ffmpeg 4.4.

@xvitaly
Copy link
Contributor

xvitaly commented Aug 14, 2022

The most long-standing issue with Fedora package is it's built with non-recommended build flags, e.g. GTK integration was disabled right until its deletion what was causing issues with clipboard and etc.

This issue was resolved over a year ago. Also an option for building without GTK integration was an integral part of Telegram Desktop build scenario. We just used build-in build flag.

Now Fedora build uses standard build flags and standard configuration (even for static tg_owt).

Yeah. As you can see, Arch already fixed this problem.

This is a temporary workaround, not a fix. Such compatible packages are not permanent.

More and more distributions get ffmpeg 5.x:

Packaging status

Fedora shouldn't remove old version of packages if some packages still depend on them.

There is only one version of each package in Fedora repositories. This is a part of the development process. We test builds against new versions and then report issues to upstreams.

@pmoieni
Copy link

pmoieni commented Aug 14, 2022

@xvitaly also I should note that the Persian font used in the fedora repos for telegram is not the one used for the official version Which is vazir matn font.
You can't even differentiate between the numbers 3 and 4.

@xvitaly
Copy link
Contributor

xvitaly commented Aug 14, 2022

@xvitaly also I should note that the Persian font used in the fedora repos for telegram is not the one used for the official version Which is vazir matn font.

That's true. We can't use bundled fonts for legal reasons. We use build-in option to prefer packaged version. I think if you install Vazir fonts system-wide, Telegram Desktop will start using them.

@ilya-fedin
Copy link
Contributor

All these issues were resolved over a year ago. Fedora build uses standard build flags and standard configuration (even for static tg_owt).

Nice to hear. You asked for proofs, I provided them.

This is a temporary workaround, not a fix. Such compatible packages are not permanent.

Yeah, at some point someone would port tdesktop to ffmpeg 5 guess. Right now this doesn't seem to be a priority for anyone, so compatibility package is a must for you if you don't have the power to make the port on your own.

There is only one version of each package in Fedora repositories. This is a part of the development process. We test builds against new versions and then report issues to upstreams.

Well, your development process should include either compatibility packages for transition time or some team that would help upstreams porting to newer libraries. Not all upstreams have manpower to follow your speed. tdesktop is one of them, there's only one person working full-time (just like with any other official Telegram client).

@ilya-fedin
Copy link
Contributor

also I should note that the Persian font used in the fedora repos for telegram is not the one used for the official version

Oh, so they still differ in build options. What a shame.

@pmoieni
Copy link

pmoieni commented Aug 14, 2022

@xvitaly also I should note that the Persian font used in the fedora repos for telegram is not the one used for the official version Which is vazir matn font.

That's true. We can't use bundled fonts for legal reasons. We use build-in option to prefer packaged version. I think if you install Vazir fonts system-wide, Telegram Desktop will start using them.

I've already tried that but doesn't seem to detect the font. Looks like telegram uses an XML config file for storing font metadata. That needs to change too.
Anyway, I'm not sure if this bug is related to this issue.
Vazir matn font is open-source on GitHub though.

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Aug 14, 2022

I think if you install Vazir fonts system-wide, Telegram Desktop will start using them.

Choosing the default for some writing system is not trivial with fontconfig, unfortunately. One needs to dig into the fontconfig's XML configuration world. The result won't be identical anyway though as the bundled fonts are patched to workaround some Qt bugs about bold variants. That's why the default is to use bundled fonts.

@xvitaly
Copy link
Contributor

xvitaly commented Aug 14, 2022

The result won't be identical anyway though as the bundled fonts are patched to workaround some Qt bugs about bold variants. That's why the default is to use bundled fonts.

OK. I'll ask for an exception for using bundled fonts.

@xvitaly
Copy link
Contributor

xvitaly commented Aug 14, 2022

@ilya-fedin @pmoieni Fonts should be fixed now: rpmfusion/telegram-desktop@ebe700f

@xvitaly
Copy link
Contributor

xvitaly commented Aug 14, 2022

@ilya-fedin Fixed in telegram-desktop-4.1.0-1.fc36 by building against openssl 1.1 and ffmpeg 4.4.
@pmoieni Fonts should be fixed too.

@Aokromes
Copy link
Collaborator

so, i can close this?

@xvitaly
Copy link
Contributor

xvitaly commented Aug 14, 2022

so, i can close this?

I guess so.

@pmoieni
Copy link

pmoieni commented Aug 16, 2022

Fonts should be fixed too.

@xvitaly sorry for late response, but I installed telegram using dnf and the previous Font was still there. Even though I have vazir matn font installed system-wide.

@xvitaly
Copy link
Contributor

xvitaly commented Aug 16, 2022

sorry for late response, but I installed telegram using dnf and the previous Font was still there. Even though I have vazir matn font installed system-wide.

New build is still in testing. Use this command to get it:

sudo dnf upgrade --refresh telegram-desktop --enablerepo=rpmfusion-free-updates-testing

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants