telegramdesktop / tdesktop

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

100% CPU once started #28040

Closed Hi-Angel closed 4 months ago

Hi-Angel commented 4 months ago

Steps to reproduce

  1. Download Telegram from https://desktop.telegram.org/
  2. Unpack and launch it (Note: you don't have to log in, just launching is enough)
  3. See CPU usage

Expected behaviour

It shouldn't take any noticeable CPU

Actual behaviour

It takes 100% of CPU

Operating system

Archlinux

Version of Telegram Desktop

5.1.4

Installation source

Static binary from official website

Crash ID

No response

Logs

[2024.06.12 00:23:29] Launched version: 5001004, install beta: [TRUE], alpha: 0, debug mode: [FALSE]
[2024.06.12 00:23:29] Executable dir: /home/constantine/Downloads/Telegram/, name: Telegram
[2024.06.12 00:23:29] Initial working dir: /home/constantine/Downloads/
[2024.06.12 00:23:29] Working dir: /home/constantine/.local/share/TelegramDesktop/
[2024.06.12 00:23:29] Command line: ./Telegram/Telegram
[2024.06.12 00:23:29] Executable path before check: /home/constantine/Downloads/Telegram/Telegram
[2024.06.12 00:23:29] Logs started
[2024.06.12 00:23:29] App ID: org.telegram.desktop._df402ab0360fe0cad3d38eea626c707b
[2024.06.12 00:23:30] Connecting local socket to 47f907409cc8e22e181684b2298e518a-TelegramDesktop...
[2024.06.12 00:23:30] Socket connect error 0, starting server and app...
[2024.06.12 00:23:30] Moved logging from '/home/constantine/.local/share/TelegramDesktop/log_start0.txt' to '/home/constantine/.local/share/TelegramDesktop/log.txt'!
[2024.06.12 00:23:30] Global devicePixelRatio: 1
[2024.06.12 00:23:30] QT_AUTO_SCREEN_SCALE_FACTOR: 0
[2024.06.12 00:23:30] Primary screen DPI: 96, Base: 96.
[2024.06.12 00:23:30] Computed screen scale: 100
[2024.06.12 00:23:30] DevicePixelRatio: 1
[2024.06.12 00:23:30] ScreenScale: 100
[2024.06.12 00:23:30] Icon theme: breeze
[2024.06.12 00:23:30] Fallback icon theme: oxygen
[2024.06.12 00:23:30] Media Info: Type Playback, default: Встроенное аудио Аналоговый стерео, list: { "Встроенное аудио Аналоговый стерео" <Встроенное аудио Аналоговый стерео> }, full list refresh: true
[2024.06.12 00:23:30] Media Info: Type Capture, default: Встроенное аудио Аналоговый стерео, list: { "Встроенное аудио Аналоговый стерео" <Встроенное аудио Аналоговый стерео>, "Monitor of Встроенное аудио Аналоговый стерео" <Monitor of Встроенное аудио Аналоговый стерео> }, full list refresh: true
[2024.06.12 00:23:30] Media Info: Type Camera, default: usb-0000:00:13.2-2, list: { "WebCam SCB-1100N: WebCam SCB-11" <usb-0000:00:13.2-2> }, full list refresh: true
[2024.06.12 00:23:30] System tray available: [TRUE]
[2024.06.12 00:23:30] App Info: reading settings...
[2024.06.12 00:23:30] App Info: reading encrypted settings...
[2024.06.12 00:23:30] Font: from ':/gui/fonts/OpenSans-Regular.ttf' loaded 'Open Sans'
[2024.06.12 00:23:30] Font: from ':/gui/fonts/OpenSans-Italic.ttf' loaded 'Open Sans'
[2024.06.12 00:23:30] Font: from ':/gui/fonts/OpenSans-SemiBold.ttf' loaded 'Open Sans'
[2024.06.12 00:23:30] Font: from ':/gui/fonts/OpenSans-SemiBold.ttf' loaded 'Open Sans Semibold'
[2024.06.12 00:23:30] Font: from ':/gui/fonts/OpenSans-SemiBoldItalic.ttf' loaded 'Open Sans'
[2024.06.12 00:23:30] Font: from ':/gui/fonts/OpenSans-SemiBoldItalic.ttf' loaded 'Open Sans Semibold'
[2024.06.12 00:23:30] Font: from ':/gui/fonts/Vazirmatn-UI-NL-Regular.ttf' loaded 'Vazirmatn UI NL'
[2024.06.12 00:23:30] Font: from ':/gui/fonts/Vazirmatn-UI-NL-SemiBold.ttf' loaded 'Vazirmatn UI NL'
[2024.06.12 00:23:30] Font: from ':/gui/fonts/Vazirmatn-UI-NL-SemiBold.ttf' loaded 'Vazirmatn UI NL SemiBold'
[2024.06.12 00:23:30] OpenAL Logging Level: (not set)
[2024.06.12 00:23:30] OpenGL Profile: Compatibility.
[2024.06.12 00:23:30] OpenGL Renderer: AMD SUMO (DRM 2.50.0 / 6.9.3-zen1-1-zen, LLVM 17.0.6)
[2024.06.12 00:23:30] OpenGL Vendor: Mesa
[2024.06.12 00:23:30] OpenGL Version: 4.5 (Compatibility Profile) Mesa 24.1.1-arch1.1
[2024.06.12 00:23:30] OpenGL Extensions: GL_ARB_shading_language_packing, GL_AMD_draw_buffers_blend, GL_ARB_seamless_cube_map, GL_KHR_texture_compression_astc_sliced_3d, GL_EXT_draw_range_elements, GL_OES_read_format, GL_EXT_texture_cube_map, GL_AMD_vertex_shader_layer, GL_NV_conditional_render, GL_NV_ES1_1_compatibility, GL_SGIS_texture_border_clamp, GL_S3_s3tc, GL_ARB_blend_func_extended, GL_NV_depth_clamp, GL_ARB_point_parameters, GL_EXT_gpu_shader4, GL_ARB_texture_view, GL_ARB_framebuffer_sRGB, GL_ARB_texture_env_add, GL_ARB_texture_mirrored_repeat, GL_EXT_texture_compression_rgtc, GL_EXT_texture_integer, GL_OES_EGL_image, GL_EXT_abgr, GL_ARB_ES3_2_compatibility, GL_ARB_shader_storage_buffer_object, GL_EXT_texture_mirror_clamp, GL_EXT_texture_filter_anisotropic, GL_EXT_texture_object, GL_KHR_robustness, GL_ARB_shader_texture_image_samples, GL_ARB_clear_buffer_object, GL_ARB_shader_precision, GL_AMD_pinned_memory, GL_NV_texture_barrier, GL_ARB_robustness, GL_ARB_texture_rg, GL_AMD_seamless_cubemap_per_texture, GL_ARB_vertex_array_object, GL_ARB_framebuffer_object, GL_ARB_vertex_type_2_10_10_10_rev, GL_EXT_provoking_vertex, GL_ARB_direct_state_access, GL_AMD_shader_stencil_export, GL_ARB_shader_bit_encoding, GL_EXT_texture_lod_bias, GL_ARB_framebuffer_no_attachments, GL_ARB_texture_gather, GL_NV_fog_distance, GL_EXT_texture_array, GL_ARB_texture_mirror_clamp_to_edge, GL_MESA_window_pos, GL_ARB_copy_image, GL_ARB_seamless_cubemap_per_texture, GL_ARB_transform_feedback_instanced, GL_EXT_texture_buffer_object, GL_ARB_compressed_texture_pixel_storage, GL_ARB_transpose_matrix, GL_AMD_query_buffer_object, GL_ARB_depth_clamp, GL_EXT_framebuffer_blit, GL_ARB_texture_buffer_object_rgb32, GL_ARB_shader_atomic_counters, GL_ARB_sync, GL_ARB_compatibility, GL_ARB_half_float_vertex, GL_ARB_multitexture, GL_SGIS_generate_mipmap, GL_ARB_debug_output, GL_EXT_transform_feedback, GL_ARB_sampler_objects, GL_ARB_copy_buffer, GL_ARB_vertex_shader, GL_ARB_fragment_coord_conventions, GL_KHR_context_flush_control, GL_EXT_blend_func_separate, GL_EXT_fog_coord, GL_ARB_get_program_binary, GL_ARB_texture_rgb10_a2ui, GL_ARB_fragment_program, GL_ARB_texture_storage, GL_EXT_stencil_wrap, GL_NV_texture_env_combine4, GL_ATI_meminfo, GL_ANGLE_texture_compression_dxt3, GL_ARB_draw_elements_base_vertex, GL_EXT_packed_pixels, GL_ARB_occlusion_query2, GL_ARB_get_texture_sub_image, GL_ARB_explicit_uniform_location, GL_ARB_texture_buffer_object, GL_ARB_texture_query_lod, GL_IBM_rasterpos_clip, GL_ARB_texture_swizzle, GL_AMD_performance_monitor, GL_NV_primitive_restart, GL_EXT_texture_storage, GL_ARB_multi_bind, GL_EXT_copy_texture, GL_ARB_spirv_extensions, GL_EXT_texture3D, GL_EXT_blend_minmax, GL_ARB_derivative_control, GL_ARB_draw_indirect, GL_ARB_gpu_shader5, GL_EXT_timer_query, GL_EXT_gpu_program_parameters, GL_SUN_multi_draw_arrays, GL_ARB_clear_texture, GL_ARB_transform_feedback3, GL_NV_texgen_reflection, GL_EXT_blend_subtract, GL_ARB_vertex_attrib_binding, GL_ARB_draw_instanced, GL_KHR_texture_compression_astc_ldr, GL_ARB_depth_buffer_float, GL_ARB_shader_objects, GL_ATI_separate_stencil, GL_NV_alpha_to_coverage_dither_control, GL_EXT_subtexture, GL_ARB_shader_clock, GL_ARB_gpu_shader_int64, GL_EXT_texture, GL_ANGLE_texture_compression_dxt5, GL_AMD_multi_draw_indirect, GL_EXT_texture_swizzle, GL_ARB_sample_shading, GL_ARB_map_buffer_range, GL_ARB_shader_image_load_store, GL_ARB_vertex_type_10f_11f_11f_rev, GL_EXT_blend_color, GL_EXT_stencil_two_side, GL_ARB_texture_stencil8, GL_ARB_stencil_texturing, GL_ARB_fragment_program_shadow, GL_ARB_color_buffer_float, GL_MESA_texture_signed_rgba, GL_ARB_query_buffer_object, GL_ARB_tessellation_shader, GL_ARB_instanced_arrays, GL_ARB_shader_stencil_export, GL_ARB_texture_env_combine, GL_ARB_draw_buffers_blend, GL_EXT_point_parameters, GL_ARB_texture_query_levels, GL_ARB_texture_storage_multisample, GL_EXT_texture_env_combine, GL_ARB_draw_buffers, GL_EXT_vertex_array, GL_ARB_ES3_compatibility, GL_EXT_packed_depth_stencil, GL_ARB_texture_multisample, GL_ARB_robust_buffer_access_behavior, GL_ATI_texture_float, GL_
ARB_internalformat_query2, GL_ARB_uniform_buffer_object, GL_EXT_texture_sRGB_R8, GL_ARB_shading_language_100, GL_NV_light_max_exponent, GL_EXT_draw_buffers2, GL_EXT_packed_float, GL_KHR_debug, GL_EXT_texture_snorm, GL_ARB_vertex_array_bgra, GL_KHR_robust_buffer_access_behavior, GL_ARB_multi_draw_indirect, GL_EXT_vertex_array_bgra, GL_ARB_compute_shader, GL_KHR_no_error, GL_ARB_base_instance, GL_IBM_multimode_draw_arrays, GL_EXT_blend_equation_separate, GL_EXT_shader_integer_mix, GL_ARB_shader_atomic_counter_ops, GL_ARB_shading_language_include, GL_ARB_texture_barrier, GL_EXT_texture_compression_s3tc, GL_ARB_shading_language_420pack, GL_ARB_pipeline_statistics_query, GL_EXT_bgra, GL_EXT_compiled_vertex_array, GL_EXT_rescale_normal, GL_ARB_vertex_buffer_object, GL_ARB_gpu_shader_fp64, GL_EXT_separate_specular_color, GL_ARB_internalformat_query, GL_ATI_texture_compression_3dc, GL_AMD_vertex_shader_viewport_index, GL_ARB_vertex_attrib_64bit, GL_NV_packed_depth_stencil, GL_ARB_fragment_layer_viewport, GL_ARB_program_interface_query, GL_ARB_shadow, GL_ARB_invalidate_subdata, GL_EXT_texture_shared_exponent, GL_ARB_clip_control, GL_MESA_framebuffer_flip_y, GL_EXT_polygon_offset_clamp, GL_ARB_enhanced_layouts, GL_ARB_buffer_storage, GL_EXT_texture_sRGB, GL_EXT_texture_sRGB_decode, GL_EXT_memory_object_fd, GL_ARB_polygon_offset_clamp, GL_ARB_texture_compression, GL_ATI_draw_buffers, GL_AMD_depth_clamp_separate, GL_EXT_direct_state_access, GL_ATI_blend_equation_separate, GL_EXT_texture_compression_latc, GL_EXT_EGL_sync, GL_KHR_parallel_shader_compile, GL_ARB_texture_buffer_range, GL_ARB_texture_non_power_of_two, GL_EXT_vertex_attrib_64bit, GL_ARB_texture_border_clamp, GL_ARB_texture_float, GL_EXT_multi_draw_arrays, GL_APPLE_packed_pixels, GL_AMD_texture_texture4, GL_ARB_texture_filter_anisotropic, GL_ARB_map_buffer_alignment, GL_EXT_secondary_color, GL_NV_blend_square, GL_ARB_vertex_program, GL_IBM_texture_mirrored_repeat, GL_SGIS_texture_lod, GL_ARB_parallel_shader_compile, GL_ARB_cull_distance, GL_EXT_framebuffer_multisample_blit_scaled, GL_NV_vdpau_interop, GL_ARB_provoking_vertex, GL_ARB_texture_compression_bptc, GL_AMD_shader_trinary_minmax, GL_EXT_memory_object, GL_MESA_shader_integer_functions, GL_EXT_framebuffer_sRGB, GL_ARB_point_sprite, GL_ARB_shader_texture_lod, GL_EXT_texture_compression_dxt1, GL_EXT_texture_env_dot3, GL_ARB_occlusion_query, GL_EXT_texture_rectangle, GL_ARB_depth_texture, GL_NV_copy_image, GL_EXT_framebuffer_object, GL_ARB_transform_feedback2, GL_NVX_gpu_memory_info, GL_EXT_EGL_image_storage, GL_NV_texture_rectangle, GL_ARB_multisample, GL_ARB_arrays_of_arrays, GL_ARB_gl_spirv, GL_EXT_pixel_buffer_object, GL_ATI_fragment_shader, GL_ARB_shader_image_size, GL_AMD_conservative_depth, GL_ARB_viewport_array, GL_ARB_ES2_compatibility, GL_ARB_texture_env_dot3, GL_ARB_shader_subroutine, GL_ARB_separate_shader_objects, GL_ATI_texture_mirror_once, GL_ARB_texture_env_crossbar, GL_INGR_blend_func_separate, GL_ARB_texture_rectangle, GL_EXT_texture_env_add, GL_NV_half_float, GL_ARB_conditional_render_inverted, GL_ARB_timer_query, GL_ARB_texture_compression_rgtc, GL_ARB_ES3_1_compatibility, GL_ARB_texture_cube_map_array, GL_EXT_debug_label, GL_EXT_shadow_funcs, GL_ARB_conservative_depth, GL_MESA_pack_invert, GL_ARB_texture_cube_map, GL_ARB_window_pos, GL_ATI_texture_env_combine3, GL_EXT_framebuffer_multisample, GL_SGIS_texture_edge_clamp, GL_ARB_pixel_buffer_object, GL_EXT_draw_instanced, GL_ARB_fragment_shader, GL_ARB_explicit_attrib_location, GL_EXT_texture_edge_clamp, GL_ARB_half_float_pixel
[2024.06.12 00:23:30] OpenGL: QOpenGLContext created, version: 4.4.
[2024.06.12 00:23:30] App Info: reading accounts info...
[2024.06.12 00:23:30] App Info: reading encrypted info...
[2024.06.12 00:23:31] OpenGL: [TRUE] (Window)
[2024.06.12 00:23:31] Notification daemon product name: Plasma
[2024.06.12 00:23:31] Notification daemon vendor name: KDE
[2024.06.12 00:23:31] Notification daemon version: 6.0.5
[2024.06.12 00:23:31] Notification daemon specification version: 1.2
[2024.06.12 00:23:31] Notification daemon capabilities: body, body-hyperlinks, body-markup, body-images, icon-static, actions, persistence, inline-reply, x-kde-urls, x-kde-origin-name, x-kde-display-appname, inhibitions
Hi-Angel commented 4 months ago

This is weird, the issue template lost data. I was basically saying the problem is not reproducible on my newer laptop, but I have to use the older one for now and I immediately stumble upon this problem.

Hi-Angel commented 4 months ago

I wish people didn't use Github issue auto-template, because it frequently loses data.

ilya-fedin commented 4 months ago

I see only a short time spike in CPU consumption which looks expected to me. What is the issue?

Hi-Angel commented 4 months ago

I see only a short time spike in CPU consumption which looks expected to me. What is the issue?

Well, I'm not sure seeing such picture non-stop all the time while Telegram is running counts as a spike…

image

ilya-fedin commented 4 months ago

so I can't reproduce that

Hi-Angel commented 4 months ago

Yes, as I mentioned it's not reproducible on my newer laptop either, but I have to work on the older laptop now and it is a problem there.

ilya-fedin commented 4 months ago

Well, I can't do anything if I can't reproduce. Sorry.

Satoshics commented 4 months ago

Hi, I think that I have got the same issue and can reproduce it https://ibb.co/6HZ6RXj here is the error, that I receive every time, I try to launch it image

Hi-Angel commented 4 months ago

@Satoshics by any chance, are you using a KDE Wayland? I've noticed that this issue is only reproducible under KDE Wayland, but not under KDE X11 or Gnome Wayland. So it's most likely a kwin's problem. I didn't report it to kwin though as I didn't have time.

Satoshics commented 4 months ago

Not exactly, I am using Wayland, but with hyprland

Hi-Angel commented 4 months ago

I see. Please test if it's reproducible on your system with another Wayland compositor (besides kwin of course), and if it isn't, I presume you might need to create a report to hyprland.

Hi-Angel commented 4 months ago

Just to be clear: it may be a bug in Telegram (which is why I'm not closing it), but given the fact Gnome Wayland has a way to avoid it, it may also be something that a compositor may trivially work around, e.g. in case there might be some other programs that misbehave same way.

ilya-fedin commented 4 months ago

Note that third party builds are affected by https://bugreports.qt.io/browse/QTBUG-120565 while official builds (not distro official builds which are third party for Telegram but the Telegram official builds from https://desktop.telegram.org) have patched Qt to avoid this bug. If anyone of you are using not an official build with patched Qt, you may experience this bug which has no other solution than switching to official build with patched Qt.

Satoshics commented 4 months ago

thanks ilya, you really helped, i think this issue related to AUR at least for me, as the official build works fine

Hi-Angel commented 4 months ago

FTR, the original issue is reported for the official build, it's also part of "steps-to-reproduce".

ilya-fedin commented 4 months ago

Well, it seems my feeling that people using third party builds are mixing their unrelated issues here was right

ilya-fedin commented 4 months ago

I was seeking multiple days for a similar issue reported a bit earlier and I think I found it - #27930. The reporter of that issue has disappeared, though. The uploaded debug logs have MTP Info: dcWithShift 2 stopped send timer, can wait for 0ms from current 0 (session.cpp : 25) lines which might be related (sounds like reconnecting every 0ms although I may be wrong) so it's a good idea to check your logs for similar lines.

I have a feeling that this is somehow related to getting last user input time, there were reports that it slows down the application on Wayland but not on X11, the reports were primarily from GNOME Wayland users back then, though. It got solved by calling the API not that frequent but maybe this reconnecting thing or something else calls it too frequent again... Launching the application with DBUS_SESSION_BUS_ADDRESS=0 should show whether it's related to D-Bus requests (which getting last user input time is on Wayland while is a X11 request on X11, although it's far from being the only D-Bus request tdesktop does).

The only way to know for sure is likely to run tdesktop under a CPU profiler, though. Can you do that? Not sure whether that would show anything useful with the binary though, you might need to build tdesktop from source with debug symbols.

Hi-Angel commented 4 months ago

Well… that's an anticlimactic ending… It just stopped reproducing 👀 I swear I changed nothing at all: I did not update the system since then, nor I re-download Telegram from the site, it's the same binary the bug was reported against. Environment is completely the same. No idea what happened.

It was reproducible with both official and non-official binaries — but now it happens with neither. Logging in also does not make it appear (tested with both binaries).

The uploaded debug logs have MTP Info: dcWithShift 2 stopped send timer, can wait for 0ms from current 0 (session.cpp : 25) lines which might be related (sounds like reconnecting every 0ms although I may be wrong) so it's a good idea to check your logs for similar lines.

Well, at least I can reply on that part: these lines should appear in the same log file that I have pasted on this issue, and I can see here that the word MTP is not mentioned there. Also note that the problem was happening to me without even logging in, so there may not even be anything to connect to at that stage. The logs in the report were taken from "non-logged in Telegram with 100% CPU load".

ilya-fedin commented 4 months ago

these lines should appear in the same log file that I have pasted on this issue,

No, those lines are written only to the logs in the DebugLogs folder, not to the log.txt.

so there may not even be anything to connect to at that stage

tdesktop connects right from the first launch I believe

Hi-Angel commented 4 months ago

these lines should appear in the same log file that I have pasted on this issue,

No, those lines are written only to the logs in the DebugLogs folder, not to the log.txt.

Oh, so there's more than one log, I see. The reason I concluded that was because I found the "MTP" line on the linked issue, and as the user didn't mention what file did they get it from, I just looked at the beginning of the log and compared to mine. First lines match, so I thought it is the same file. Sorry for confusion.