telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
26.23k stars 5.2k forks source link

Fatal memory leak bugs #27673

Closed sapphirepro closed 6 months ago

sapphirepro commented 7 months ago

Steps to reproduce

  1. Open telegram desktop.
  2. Open some profile with 30+ photos and view them all
  3. Open process monitoring tool
  4. see how crazy amount ram and video ram eaten

Expected behaviour

Below 1GB ram used and below 300 mb vram used

Actual behaviour

Memory leaks around every corner. Quality of app is disgusting, especially counting I have paid for telegram premium.

Fix finally disgusting application quality and endless memory leaks. I don't care of telegram rolling new features non stop, quality is to have #1 . All those new features are nonsense, counting desktop application fully broken.

Also it fails to play videos on click with sound (ends up with non stop loading) and easily trashed whole system away when insane leaks happen that can eat whole 64GB of RAM.

Screenshot_20240330_231609-1

Operating system

OpenSuse Tumbleweed

Version of Telegram Desktop

Latest

Installation source

Static binary from official website

Crash ID

No response

Logs

QPainter::begin: Paint device returned engine == 0, type: 2
QWidget::render: Cannot render with an inactive painter
qt.gui.imageio.jpeg: Corrupt JPEG data: premature end of data segment
ilya-fedin commented 7 months ago

2. Open some profile with 30+ photos and view them all

You mean just scrolling or opening in the viewer?

ilya-fedin commented 7 months ago

and below 300 mb vram used

How do you look VRAM usage? I fail to find anything on my system that would show it.

sapphirepro commented 7 months ago

and below 300 mb vram used

How do you look VRAM usage? I fail to find anything on my system that would show it.

In Linux it's application called "Resources". You just need to enable there in setting to show vram usage and it shows it. Very nice modern tool. You can get either prebuilt package from your distro, or from here => https://github.com/nokyan/resources

sapphirepro commented 7 months ago
  1. Open some profile with 30+ photos and view them all

You mean just scrolling or opening in the viewer?

Yes.

ilya-fedin commented 7 months ago

Yes.

Which one of these?

sapphirepro commented 7 months ago

Yes.

Which one of these?

I mean find some contact with 30+ photos in phofile, click on it and start scrolling them all in Telegram's built in viewer. Especially if videos also there, Telegram lags completely and often not playing at all

ilya-fedin commented 7 months ago

I mean find some contact with 30+ photos in phofile, click on it and start scrolling them all in Telegram's built in viewer.

Do you mean this Or avatars? Or maybe it doesn't really matter?

ilya-fedin commented 7 months ago

I'm unable to reproduce scrolling in the viewer through those 10196 photos... I had 60% of the VRAM consumed before launching tdesktop (can I find what consumes it?) and I don't see major increase in consumption after using it. Could it be a bug in your graphics drivers? Have you tried launching tdesktop with llvmpipe or zink?

fcore117 commented 7 months ago

Personally i always prevent Telegram ever using GPU(I always turn off GPU from Telegram options). In my point of view IM app never should use GPU, never. I only allow real serious 3D software to use GPU. My Telegram consumes between 100-200mb RAM max.

ilya-fedin commented 7 months ago

Well, without IM applications using GPU, you is likely to have troubles with high resolution (how high depends on CPU, of course) video in those applications... Things like color conversion or image scaling are best done by GPU.

fcore117 commented 7 months ago

Well, without IM applications using GPU, you is likely to have troubles with high resolution (how high depends on CPU, of course) video in those applications... Things like color conversion or image scaling are best done by GPU.

In your case i can see this useful, for me i do everything like this externally out of Telegram. Often telegram p2p calls running hours in background when doing graphics related things in collaboration and i like that Telegram do not touch GPU ever. Detaching not needed apps from GPU is highly useful to lessen GPU related anomalies vice-versa. There where often times when i soft collapsed GPU driver with heavy graphics workload and all GPU using apps collapsed, but Telegram survived and i instantly launched graphics app to continue work.

ilya-fedin commented 7 months ago

p2p calls if they are video calls, relate to this too. In fact GPU rendering was added exactly because video calls on CPU is a performance disaster.

fcore117 commented 7 months ago

p2p calls if they are video calls, relate to this too. In fact GPU rendering was added exactly because video calls on CPU is a performance disaster.

For me CPU had been very low with video calls, maybe because 720p or max 1080p. Anyway 98% i use just audio calls only.

In the end i am glad there is always option to turn off Telegram GPU. Everyone has a choice this is most important thing. Even one of my relatives had to turn off Telegram GPU as it caused too much anomalies.

sapphirepro commented 7 months ago

I mean find some contact with 30+ photos in phofile, click on it and start scrolling them all in Telegram's built in viewer.

Do you mean this Or avatars? Or maybe it doesn't really matter?

I meant profile pictures and stories in profile.

sapphirepro commented 7 months ago

I'm unable to reproduce scrolling in the viewer through those 10196 photos... I had 60% of the VRAM consumed before launching tdesktop (can I find what consumes it?) and I don't see major increase in consumption after using it. Could it be a bug in your graphics drivers? Have you tried launching tdesktop with llvmpipe or zink?

Screenshot_20240401_211100

To be more precise I mean this. Profile photos, pics and videos in profile and stories. As you can see on screenshot it even fails to load profile pic normally, which is common bug for many versions already here. Regarding GPU, I am pretty sure it's not gpu or driver fails, as all the rest works perfectly. Just click on person's avatar and scroll them all, best is someone having live 30+ profile photos. It will eat ram, vram and most probably even crash or cause machine to hang due to out of ram due to memory leak bugs

And avatar like that is not normal. It's not gpu failure. It's just telegram failing to load picture completely, remains like half-loaded one. Those events with half-loaded pics in profiles are totally random. Sometimes loads and loads even videos, sometimes totally fails and photo in profile will remain like this and video with just a blurry frame and loading forever sign

sapphirepro commented 7 months ago

And to be even more precise of what to look at is here.

Just click on that round face icon on top (picture/photo), not below in "photos, images, media etc". In given example just round photo to the left of channel name Screenshot_20240401_211631

ilya-fedin commented 7 months ago

Regarding GPU, I am pretty sure it's not gpu or driver fails, as all the rest works perfectly.

Anyway, can you try? I believe if this was really a bug in tdesktop then there would be lots of reports but you seem to be the only one.

Just click on that round face icon on top (picture/photo), not below in "photos, images, media etc".

I fail to find people with such big amount of avatars... Can you give some examples?

jcmadrioso commented 7 months ago

Regarding with multimedia, after today update to 4.16 version, on Debian 12.5, it crashes whenever a video call is initiated. Disabling OpenGL rendering is a workaround.

sapphirepro commented 7 months ago

I fail to find people with such big amount of avatars... Can you give some examples?

Yes, sure. For example this one: https://t.me/little_bad_girl_pixie

sapphirepro commented 7 months ago

Have you tried launching tdesktop with llvmpipe or zink?

I don't know what's that to be honest. Any detailed instructions? To the rest questions I provided all info needed.

ilya-fedin commented 7 months ago

I don't know what's that to be honest.

You should set a LIBGL_ALWAYS_SOFTWARE=1 environment variable for llvmpipe or MESA_LOADER_DRIVER_OVERRIDE=zink for zink

ilya-fedin commented 7 months ago

Yes, sure. For example this one: https://t.me/little_bad_girl_pixie

I can't reprdoduce. This resources application shows ~350 MB RAM consumption after scrolling through the pictures. Overall VRAM consumption was 42% at the time and decreased to 37% after exiting from tdesktop.

sapphirepro commented 7 months ago

Yes, sure. For example this one: https://t.me/little_bad_girl_pixie

I can't reprdoduce. This resources application shows ~350 MB RAM consumption after scrolling through the pictures. Overall VRAM consumption was 42% at the time and decreased to 37% after exiting from tdesktop.

I tried another installation as was suggested by another source, from RPM and customized. It unintentionally lead to logout and settings drop. Configuring it all the same way as was +/- solved situation. Not crashing anymore, but some videos/photos still remain loading forever. So seems Telegram has some issues with configs stored for years

github-actions[bot] commented 6 months ago

This issue has been automatically closed because no developer succeeded to reproduce the issue with the given reproduction steps. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you find what's missing to reproduce the issue so that we can investigate further.

Note that GitHub is a developer communication platform. If you're an ordinary user seeking for help, get to support crew via Settings -> Ask question in the application.