tdesktop icon indicating copy to clipboard operation
tdesktop copied to clipboard

High CPU usage out of nowhere

Open SinTan1729 opened this issue 3 years ago • 10 comments

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 avatar Jan 15 '22 04:01 SinTan1729

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

ghost avatar Mar 23 '22 20:03 ghost

3.6.1, Archlinux, KDE — the same. Screenshot_20220411_102801

top4ek avatar Apr 11 '22 07:04 top4ek

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

IgnatBeresnev avatar Apr 13 '22 17:04 IgnatBeresnev

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?

simoneruffini avatar Jun 06 '22 21:06 simoneruffini

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 avatar Jul 14 '22 18:07 pmoieni

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.

pmoieni avatar Jul 15 '22 09:07 pmoieni

same issue, it's annoying

ghost avatar Aug 06 '22 09:08 ghost

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.

ilya-fedin avatar Aug 08 '22 04:08 ilya-fedin

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

pmoieni avatar Aug 08 '22 05:08 pmoieni

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?

simoneruffini avatar Aug 10 '22 16:08 simoneruffini

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 avatar Aug 10 '22 19:08 ilya-fedin

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.

ilya-fedin avatar Aug 10 '22 21:08 ilya-fedin

@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?

ohhai avatar Aug 12 '22 17:08 ohhai

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 avatar Aug 13 '22 00:08 ilya-fedin

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

ilya-fedin avatar Aug 13 '22 00:08 ilya-fedin

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.

xvitaly avatar Aug 13 '22 13:08 xvitaly

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.

ilya-fedin avatar Aug 13 '22 13:08 ilya-fedin

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.

leigh123linux avatar Aug 13 '22 13:08 leigh123linux

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

ilya-fedin avatar Aug 13 '22 13:08 ilya-fedin

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.

xvitaly avatar Aug 13 '22 18:08 xvitaly

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.

ilya-fedin avatar Aug 14 '22 02:08 ilya-fedin

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.

xvitaly avatar Aug 14 '22 07:08 xvitaly

@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.

pmoieni avatar Aug 14 '22 07:08 pmoieni

@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.

xvitaly avatar Aug 14 '22 07:08 xvitaly

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 avatar Aug 14 '22 07:08 ilya-fedin

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.

ilya-fedin avatar Aug 14 '22 07:08 ilya-fedin

@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.

pmoieni avatar Aug 14 '22 07:08 pmoieni

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.

ilya-fedin avatar Aug 14 '22 07:08 ilya-fedin

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 avatar Aug 14 '22 07:08 xvitaly

@ilya-fedin @pmoieni Fonts should be fixed now: https://github.com/rpmfusion/telegram-desktop/commit/ebe700feb81d5fe9523e75f739c003b715bedaa9

xvitaly avatar Aug 14 '22 08:08 xvitaly