telegramdesktop / tdesktop

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

Telegram Linux app crashes while try to play video #26784

Closed romankspb closed 12 months ago

romankspb commented 12 months ago

Steps to reproduce

  1. open any chat
  2. find any video
  3. try to play video

Expected behaviour

Playing video

Actual behaviour

Telegram Desktop application hang with error message The Wayland connection experienced a fatal error: Protocol error

$ LANG=C ./Telegram 
Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.
Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
If this causes problems, reconfigure your locale. See the locale(1) manual
for more information.
QPainter::begin: Paint device returned engine == 0, type: 2
QWidget::render: Cannot render with an inactive painter
qt.core.qobject.connect: QObject::connect: No such signal QPlatformNativeInterface::systemTrayWindowChanged(QScreen*)
qt.gui.imageio.jpeg: Corrupt JPEG data: premature end of data segment

(Telegram:13820): Gtk-WARNING **: 11:24:16.797: Theme parsing error: <data>:1:0: Expected a valid selector
The Wayland connection experienced a fatal error: Protocol error

Operating system

Fedora release 38 (Thirty Eight)

Version of Telegram Desktop

4.9.6

Installation source

Static binary from official website

Crash ID

No response

Logs

$ cat ./.local/share/TelegramDesktop/log.txt
[2023.09.13 11:24:14] Launched version: 4009006, install beta: [FALSE], alpha: 0, debug mode: [FALSE]
[2023.09.13 11:24:14] Executable dir: /home/romank/Загрузки/Telegram/, name: Telegram
[2023.09.13 11:24:14] Initial working dir: /home/romank/Загрузки/Telegram/
[2023.09.13 11:24:14] Working dir: /home/romank/.local/share/TelegramDesktop/
[2023.09.13 11:24:14] Command line: ./Telegram
[2023.09.13 11:24:14] Executable path before check: /home/romank/Загрузки/Telegram/Telegram
[2023.09.13 11:24:14] Logs started
[2023.09.13 11:24:14] App ID: org.telegram.desktop._0a70f1faa8ad16c2f029e42dfbb677f8
[2023.09.13 11:24:14] Connecting local socket to dc35a6a1ed42c65ea859a0ca947395b1-{87A94AB0-E370-4cde-98D3-ACC110C5967D}...
[2023.09.13 11:24:14] Socket connect error 0, starting server and app...
[2023.09.13 11:24:14] Moved logging from '/home/romank/.local/share/TelegramDesktop/log_start0.txt' to '/home/romank/.local/share/TelegramDesktop/log.txt'!
[2023.09.13 11:24:14] Opened '/home/romank/.local/share/TelegramDesktop/tdata/working' for reading, the previous Telegram Desktop launch was not finished properly :( Crash log size: 0
[2023.09.13 11:24:14] Global devicePixelRatio: 1
[2023.09.13 11:24:14] Primary screen DPI: 96, Base: 96.
[2023.09.13 11:24:14] Computed screen scale: 100
[2023.09.13 11:24:14] DevicePixelRatio: 1
[2023.09.13 11:24:14] ScreenScale: 100
[2023.09.13 11:24:14] Icon theme: Adwaita
[2023.09.13 11:24:14] Fallback icon theme: 
[2023.09.13 11:24:14] System tray available: [FALSE]
[2023.09.13 11:24:14] Font: from ':/gui/fonts/DAOpenSansRegular.ttf' loaded 'DAOpenSansRegular'
[2023.09.13 11:24:14] Font: from ':/gui/fonts/DAVazirRegular.ttf' loaded 'DAVazirRegular'
[2023.09.13 11:24:14] Font: from ':/gui/fonts/DAOpenSansRegularItalic.ttf' loaded 'DAOpenSansRegularItalic'
[2023.09.13 11:24:14] Font: from ':/gui/fonts/DAVazirRegular.ttf' loaded 'DAVazirRegular'
[2023.09.13 11:24:14] Font: from ':/gui/fonts/DAOpenSansSemiboldAsBold.ttf' loaded 'DAOpenSansSemibold'
[2023.09.13 11:24:14] Font: from ':/gui/fonts/DAVazirMediumAsBold.ttf' loaded 'DAVazirMedium'
[2023.09.13 11:24:14] Font: from ':/gui/fonts/DAOpenSansSemiboldItalicAsBold.ttf' loaded 'DAOpenSansSemiboldItalic'
[2023.09.13 11:24:14] Font: from ':/gui/fonts/DAVazirMediumAsBold.ttf' loaded 'DAVazirMedium'
[2023.09.13 11:24:14] Font: from ':/gui/fonts/DAOpenSansSemiboldAsBold.ttf' loaded 'DAOpenSansSemibold'
[2023.09.13 11:24:14] Font: from ':/gui/fonts/DAVazirMediumAsBold.ttf' loaded 'DAVazirMedium'
[2023.09.13 11:24:14] Font: from ':/gui/fonts/DAOpenSansSemiboldItalicAsBold.ttf' loaded 'DAOpenSansSemiboldItalic'
[2023.09.13 11:24:14] Font: from ':/gui/fonts/DAVazirMediumAsBold.ttf' loaded 'DAVazirMedium'
[2023.09.13 11:24:14] App Info: reading settings...
[2023.09.13 11:24:14] App Info: reading encrypted settings...
[2023.09.13 11:24:14] Lang Info: Loaded cached, keys: 5266
[2023.09.13 11:24:14] OpenAL Logging Level: (not set)
[2023.09.13 11:24:14] Audio Playback Devices: Family 17h/19h HD Audio Controller Аналоговый стерео
[2023.09.13 11:24:14] Audio Playback Default Device: Family 17h/19h HD Audio Controller Аналоговый стерео
[2023.09.13 11:24:14] Audio Capture Devices: Family 17h/19h HD Audio Controller Аналоговый стерео;Monitor of Family 17h/19h HD Audio Controller Аналоговый стерео
[2023.09.13 11:24:14] Audio Capture Default Device: Family 17h/19h HD Audio Controller Аналоговый стерео
[2023.09.13 11:24:14] OpenGL Profile: Compatibility.
[2023.09.13 11:24:14] OpenGL Renderer: AMD Radeon Graphics (renoir, LLVM 16.0.5, DRM 3.52, 6.3.8-200.fc38.x86_64)
[2023.09.13 11:24:14] OpenGL Vendor: AMD
[2023.09.13 11:24:14] OpenGL Version: 4.6 (Compatibility Profile) Mesa 23.1.2
[2023.09.13 11:24:14] OpenGL Extensions: GL_EXT_packed_pixels, GL_ARB_gpu_shader5, GL_NV_shader_atomic_int64, GL_EXT_shader_integer_mix, GL_NV_ES1_1_compatibility, GL_EXT_compiled_vertex_array, GL_EXT_gpu_program_parameters, GL_ARB_shader_group_vote, GL_EXT_blend_color, GL_ANGLE_texture_compression_dxt5, GL_ARB_indirect_parameters, GL_EXT_draw_buffers2, GL_ARB_shadow, GL_ARB_shader_clock, GL_ARB_texture_env_crossbar, GL_EXT_packed_depth_stencil, GL_ARB_point_parameters, GL_ARB_direct_state_access, GL_NV_conditional_render, GL_EXT_vertex_array_bgra, GL_MESA_texture_signed_rgba, GL_ARB_shading_language_include, GL_ARB_fragment_shader, GL_ARB_polygon_offset_clamp, GL_ARB_uniform_buffer_object, GL_EXT_vertex_attrib_64bit, GL_ARB_copy_image, GL_ARB_compute_shader, GL_ARB_texture_query_lod, GL_EXT_debug_label, GL_ARB_texture_mirror_clamp_to_edge, GL_ARB_base_instance, GL_EXT_framebuffer_blit, GL_EXT_texture_shared_exponent, GL_ARB_robustness, GL_ARB_tessellation_shader, GL_ARB_ES2_compatibility, GL_ATI_fragment_shader, GL_ARB_compatibility, GL_ARB_depth_texture, GL_ARB_shading_language_100, GL_ARB_multi_draw_indirect, GL_ARB_texture_cube_map, GL_NV_light_max_exponent, GL_NV_texture_barrier, GL_ARB_shader_atomic_counter_ops, GL_ARB_texture_storage, GL_NV_copy_depth_to_color, GL_EXT_bgra, GL_MESA_framebuffer_flip_y, GL_KHR_debug, GL_SGIS_texture_border_clamp, GL_ARB_texture_mirrored_repeat, GL_EXT_stencil_two_side, GL_ARB_texture_gather, GL_ARB_vertex_shader, GL_ARB_shader_ballot, GL_EXT_texture_compression_latc, GL_SGIS_texture_lod, GL_ARB_compressed_texture_pixel_storage, GL_EXT_blend_equation_separate, GL_NV_half_float, GL_EXT_point_parameters, GL_ARB_ES3_2_compatibility, GL_EXT_texture_buffer_object, GL_EXT_texture_object, GL_NV_primitive_restart, GL_EXT_texture_integer, GL_NV_compute_shader_derivatives, GL_ARB_transform_feedback_overflow_query, GL_ARB_buffer_storage, GL_KHR_texture_compression_astc_sliced_3d, GL_ARB_arrays_of_arrays, GL_ARB_shading_language_420pack, GL_ARB_seamless_cube_map, GL_ARB_map_buffer_range, GL_KHR_parallel_shader_compile, GL_ARB_conservative_depth, GL_EXT_shader_samples_identical, GL_MESA_shader_integer_functions, GL_EXT_subtexture, GL_ARB_robust_buffer_access_behavior, GL_ARB_fragment_program_shadow, GL_ATI_texture_compression_3dc, GL_ARB_texture_rgb10_a2ui, GL_AMD_draw_buffers_blend, GL_ARB_sparse_texture2, GL_NV_depth_clamp, GL_ARB_vertex_attrib_64bit, GL_ARB_multisample, GL_ARB_fragment_program, GL_EXT_texture_sRGB_R8, GL_ARB_texture_rectangle, GL_ARB_debug_output, GL_ARB_texture_float, GL_ARB_draw_instanced, GL_AMD_query_buffer_object, GL_ARB_get_program_binary, GL_ARB_texture_compression_bptc, GL_SUN_multi_draw_arrays, GL_ARB_explicit_uniform_location, GL_ARB_program_interface_query, GL_AMD_shader_trinary_minmax, GL_ARB_occlusion_query, GL_EXT_transform_feedback, GL_EXT_demote_to_helper_invocation, GL_EXT_separate_specular_color, GL_ARB_shader_atomic_counters, GL_AMD_texture_texture4, GL_EXT_draw_instanced, GL_ATI_texture_float, GL_ARB_compute_variable_group_size, GL_MESA_window_pos, GL_EXT_timer_query, GL_ARB_get_texture_sub_image, GL_ARB_instanced_arrays, GL_EXT_abgr, GL_ARB_clear_buffer_object, GL_EXT_texture_compression_rgtc, GL_ARB_shader_subroutine, GL_ARB_sampler_objects, GL_EXT_memory_object, GL_EXT_copy_texture, GL_ARB_provoking_vertex, GL_EXT_texture_swizzle, GL_KHR_no_error, GL_ARB_texture_barrier, GL_EXT_vertex_array, GL_EXT_semaphore, GL_ARB_bindless_texture, GL_NV_alpha_to_coverage_dither_control, GL_ARB_seamless_cubemap_per_texture, GL_ARB_sync, GL_ARB_separate_shader_objects, GL_EXT_texture_compression_dxt1, GL_OES_EGL_image, GL_ARB_gpu_shader_fp64, GL_ARB_pixel_buffer_object, GL_EXT_texture_lod_bias, GL_ARB_internalformat_query, GL_SGIS_texture_edge_clamp, GL_NV_fog_distance, GL_AMD_multi_draw_indirect, GL_ATI_draw_buffers, GL_ARB_sparse_buffer, GL_EXT_texture_compression_s3tc, GL_NV_texgen_reflection, GL_ARB_draw_indirect, GL_ARB_half_float_pixel, GL_AMD_vertex_shader_viewport_index, GL_AMD_shader_stencil_export, GL_ARB_texture_cube_map_array, GL_EXT_texture_snorm, GL_ATI_texture_mirror_once, GL_NV_texture_env_combine4, GL_ARB_viewport_array, GL_ARB_draw_elements_base_vertex, GL_ARB_shader_stencil_export, GL_EXT_EGL_image_storage, GL_IBM_multimode_draw_arrays, GL_ARB_gpu_shader_int64, GL_ARB_shader_image_load_store, GL_ARB_shader_texture_image_samples, GL_ARB_shader_draw_parameters, GL_INGR_blend_func_separate, GL_ARB_texture_compression, GL_EXT_shadow_funcs, GL_ARB_shader_texture_lod, GL_ARB_multitexture, GL_EXT_framebuffer_sRGB, GL_ARB_timer_query, GL_EXT_blend_subtract, GL_ARB_spirv_extensions, GL_ARB_vertex_program, GL_EXT_texture_env_add, GL_ARB_color_buffer_float, GL_AMD_framebuffer_multisample_advanced, GL_ATI_separate_stencil, GL_ARB_blend_func_extended, GL_ATI_texture_env_combine3, GL_ARB_derivative_control, GL_EXT_EGL_sync, GL_EXT_texture_edge_clamp, GL_ARB_clear_texture, GL_IBM_texture_mirrored_repeat, GL_EXT_shader_image_load_formatted, GL_ARB_texture_storage_multisample, GL_ARB_occlusion_query2, GL_ARB_vertex_array_object, GL_EXT_texture3D, GL_ARB_shader_storage_buffer_object, GL_ARB_texture_env_combine, GL_ARB_framebuffer_no_attachments, GL_ARB_invalidate_subdata, GL_ARB_texture_border_clamp, GL_EXT_texture_filter_anisotropic, GL_ARB_transform_feedback3, GL_ARB_texture_view, GL_AMD_pinned_memory, GL_ARB_pipeline_statistics_query, GL_NV_copy_image, GL_OES_read_format, GL_ARB_framebuffer_object, GL_ARB_enhanced_layouts, GL_EXT_texture_sRGB, GL_ARB_cull_distance, GL_ARB_texture_buffer_object_rgb32, GL_EXT_provoking_vertex, GL_ARB_vertex_array_bgra, GL_ARB_transpose_matrix, GL_ATI_meminfo, GL_ARB_depth_clamp, GL_ARB_texture_env_dot3, GL_ARB_texture_multisample, GL_EXT_window_rectangles, GL_ARB_shader_image_size, GL_EXT_fog_coord, GL_AMD_depth_clamp_separate, GL_ARB_texture_compression_rgtc, GL_ARB_fragment_coord_conventions, GL_ARB_sample_shading, GL_EXT_framebuffer_multisample, GL_EXT_blend_minmax, GL_ARB_shader_precision, GL_ARB_multi_bind, GL_KHR_robustness, GL_ARB_sparse_texture, GL_EXT_direct_state_access, GL_ARB_ES3_compatibility, GL_ARB_explicit_attrib_location, GL_EXT_pixel_buffer_object, GL_ARB_shader_bit_encoding, GL_INTEL_blackhole_render, GL_EXT_rescale_normal, GL_EXT_texture_array, GL_NV_packed_depth_stencil, GL_ARB_transform_feedback_instanced, GL_ARB_conditional_render_inverted, GL_EXT_polygon_offset_clamp, GL_EXT_draw_range_elements, GL_ARB_internalformat_query2, GL_EXT_depth_bounds_test, GL_EXT_texture_env_combine, GL_AMD_vertex_shader_layer, GL_ARB_clip_control, GL_ARB_texture_query_levels, GL_ARB_map_buffer_alignment, GL_EXT_texture_shadow_lod, GL_ARB_transform_feedback2, GL_ARB_parallel_shader_compile, GL_NV_vdpau_interop, GL_ARB_texture_buffer_object, GL_IBM_rasterpos_clip, GL_KHR_texture_compression_astc_ldr, GL_ARB_texture_env_add, GL_ARB_window_pos, GL_EXT_texture, GL_ANGLE_texture_compression_dxt3, GL_ARB_texture_non_power_of_two, GL_APPLE_packed_pixels, GL_ARB_depth_buffer_float, GL_EXT_semaphore_fd, GL_EXT_framebuffer_object, GL_ARB_shader_objects, GL_EXT_shader_image_load_store, GL_ARB_sparse_texture_clamp, GL_EXT_stencil_wrap, GL_ARB_vertex_type_2_10_10_10_rev, GL_ARB_point_sprite, GL_ARB_copy_buffer, GL_AMD_performance_monitor, GL_ARB_fragment_layer_viewport, GL_ARB_texture_stencil8, GL_KHR_robust_buffer_access_behavior, GL_ARB_shading_language_packing, GL_ARB_ES3_1_compatibility, GL_ARB_shader_viewport_layer_array, GL_AMD_seamless_cubemap_per_texture, GL_ATI_blend_equation_separate, GL_MESA_pack_invert, GL_KHR_blend_equation_advanced, GL_ARB_vertex_type_10f_11f_11f_rev, GL_EXT_framebuffer_multisample_blit_scaled, GL_EXT_blend_func_separate, GL_ARB_query_buffer_object, GL_ARB_texture_rg, GL_EXT_secondary_color, GL_SGIS_generate_mipmap, GL_KHR_context_flush_control, GL_EXT_texture_rectangle, GL_NVX_gpu_memory_info, GL_ARB_texture_swizzle, GL_EXT_packed_float, GL_ARB_texture_buffer_range, GL_EXT_texture_env_dot3, GL_EXT_gpu_shader4, GL_EXT_texture_cube_map, GL_ARB_half_float_vertex, GL_ARB_draw_buffers, GL_ARB_vertex_attrib_binding, GL_EXT_memory_object_fd, GL_ARB_framebuffer_sRGB, GL_EXT_texture_mirror_clamp, GL_ARB_vertex_buffer_object, GL_ARB_stencil_texturing, GL_AMD_conservative_depth, GL_ARB_draw_buffers_blend, GL_NV_blend_square, GL_EXT_multi_draw_arrays, GL_NV_texture_rectangle, GL_EXT_texture_sRGB_decode, GL_ARB_gl_spirv, GL_S3_s3tc, GL_ARB_texture_filter_anisotropic
[2023.09.13 11:24:14] OpenGL: QOpenGLContext created, version: 4.4.
[2023.09.13 11:24:14] App Info: reading accounts info...
[2023.09.13 11:24:14] App Info: reading encrypted info...
[2023.09.13 11:24:14] App Info: reading map...
[2023.09.13 11:24:14] App Info: reading encrypted map...
[2023.09.13 11:24:14] App Info: reading encrypted user settings...
[2023.09.13 11:24:14] App Info: encrypted user settings read.
[2023.09.13 11:24:14] App Info: reading encrypted mtp data...
[2023.09.13 11:24:14] MTP Info: read keys, current: 5, to destroy: 0
[2023.09.13 11:24:14] Map read time: 12
[2023.09.13 11:24:14] App Info: reading encrypted mtp config...
[2023.09.13 11:24:14] Export Info: Destroy top bar by controller removal.
[2023.09.13 11:24:14] OpenGL: [TRUE] (Window)
[2023.09.13 11:24:14] Notification daemon product name: gnome-shell
[2023.09.13 11:24:14] Notification daemon vendor name: GNOME
[2023.09.13 11:24:14] Notification daemon version: 44.2
[2023.09.13 11:24:14] Notification daemon specification version: 1.2
[2023.09.13 11:24:14] Notification daemon capabilities: actions, body, body-markup, icon-static, persistence, sound
[2023.09.13 11:24:16] API Warning: not loaded minimal channel applied.
d3cryptofc commented 12 months ago

Same thing here

Edit: Here it works again, did they solve it?

ilya-fedin commented 12 months ago

Protocol error means that Qt or mesa and your compositor haven't agreed between each other...

romankspb commented 12 months ago

Version 4.9.5 work fine, problem on 4.9.6 still persist

ilya-fedin commented 12 months ago

tdesktop doesn't talk to Wayland directly so I'm not sure anything could be done on tdesktop level

romankspb commented 12 months ago

Considering that 4.9.5 works, you can still do something on tdesktop level :)

ilya-fedin commented 12 months ago

I'm not sure what we can do? Your log just says protocol error and that's it. I can't reproduce. Maybe you got a system update with a new bug in mesa.

d3cryptofc commented 12 months ago

I am using 4.9.6, possibly it has worked when I turned on the Advanced > Experimental settings > External video player, which I currently turned off and it still works.

ilya-fedin commented 12 months ago

Maybe the client has detected your OpenGL is broken and disabled it. Check whether OpenGL works in the log.txt.

romankspb commented 12 months ago

No, I haven't updated my system. I just updated tdesktop to 4.9.6. Nothing more

ilya-fedin commented 12 months ago

@romankspb so far I believe you should report to Qt, mesa or GNOME. Not sure where exactly, I guess you have to look at your compositor's log for a better error.

NTMan commented 12 months ago

I have same bug experience when playing video

❯ ~/Downloads/Telegram/Telegram

QPainter::begin: Paint device returned engine == 0, type: 2
QWidget::render: Cannot render with an inactive painter
qt.core.qobject.connect: QObject::connect: No such signal QPlatformNativeInterface::systemTrayWindowChanged(QScreen*)
qt.gui.imageio.jpeg: Corrupt JPEG data: premature end of data segment

(Telegram:8845): Gtk-WARNING **: 00:06:53.557: Theme parsing error: <data>:1:0: Expected a valid selector
qt.gui.imageio.jpeg: Corrupt JPEG data: premature end of data segment
qt.gui.imageio.jpeg: Corrupt JPEG data: premature end of data segment
qt.gui.imageio.jpeg: Corrupt JPEG data: premature end of data segment
[libvpx-vp9 @ 0x7f40d4465000] v1.11.0
[libvpx-vp9 @ 0x7f40d4465000] v1.11.0
[libvpx-vp9 @ 0x7f40d4465400] v1.11.0
[libvpx-vp9 @ 0x7f40d4465400] v1.11.0
The Wayland connection experienced a fatal error: Protocol error

And starting video chat or audio call

❯ ~/Downloads/Telegram/Telegram

QPainter::begin: Paint device returned engine == 0, type: 2
QWidget::render: Cannot render with an inactive painter
qt.core.qobject.connect: QObject::connect: No such signal QPlatformNativeInterface::systemTrayWindowChanged(QScreen*)

(Telegram:9060): Gtk-WARNING **: 00:07:03.129: Theme parsing error: <data>:1:0: Expected a valid selector
qt.gui.imageio.jpeg: Corrupt JPEG data: premature end of data segment
The Wayland connection experienced a fatal error: Protocol error

The crashes started happens after update Telegram to 4.9.6 version and continued on 4.9.7 version. Please check working of Telegram application on Fedora Rawhide.

NTMan commented 12 months ago

I'm not sure what we can do? Your log just says protocol error and that's it. I can't reproduce. Maybe you got a system update with a new bug in mesa.

I am 200% sure that the telegram update is to blame

sbrener1610 commented 12 months ago

in /etc/gdm3/custom.conf uncomment WaylandEnable=false this helped

xscd commented 12 months ago

this is a funny one because videos actually play fine. the issue is when you open first a video it crashes. try this:

1) open a photo 2) then open a video (it will play fine) 3) in that session opening videos will work 4) leave app and re-open try opening a video first, crash again

let me know if this works for people commented here.

ilya-fedin commented 12 months ago

I am 200% sure that the telegram update is to blame

Without a more verbose error, a way for contributors to reproduct (sorry, I still can't reproduce that in a VM, perhaps that's hardware-dependent) or a bisection by someone affected to find the offending commit, I don't think anything could be done

mlsokolova commented 12 months ago

Fedora 38, Telegram 4.9.7, the same error

mlsokolova commented 12 months ago

Fedora 38, Telegram 4.9.7, the same error

It fixed after set WaylandEnable=false in /etc/gdm/custom.conf and reboot thanks @sbrener1610

NTMan commented 12 months ago

Without a more verbose error, a way for contributors to reproduct (sorry, I still can't reproduce that in a VM, perhaps that's hardware-dependent) or a bisection by someone affected to find the offending commit, I don't think anything could be done

I don't know what are you mean by verbose error, but I recorded video which prove that downgrade Telegram helps workaround this issue: https://youtu.be/Xn8VUCCjWCI

ilya-fedin commented 12 months ago

I don't know what are you mean by verbose error

I mean something more detailed than just 'protocol error'

NTMan commented 12 months ago

I mean something more detailed than just 'protocol error'

Can you guide me? Or maybe exist step by step instruction?

ilya-fedin commented 12 months ago

Can you guide me? Or maybe exist step by step instruction?

I have no idea how to get a better error, sorry. Help on this from the community would be highly appreciated.

mlsokolova commented 12 months ago

I made trace file before switching to WaylandEnable=false
strace -o telegram.trace -v -f -s 1024 ./Telegram

Maybe some from the trace file could be useful ?
For example

11278 futex(0x7fde7e915274, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
11305 recvmsg(9, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0\0\0\0\0<\0E\0\0\0\0\0\0\0%\0\0\0exported surface had an invalid role\0\0\0\0", iov_len=1768}, {iov_base="", iov_len=2328}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 60
11305 futex(0x7fde7e915274, FUTEX_WAKE_PRIVATE, 2147483647 <unfinished ...>
11278 <... futex resumed>)              = 0
11305 <... futex resumed>)              = 1
11305 write(2, "The Wayland connection experienced a fatal error: Protocol error\n", 65 <unfinished ...>
11278 futex(0x7fde7e915218, FUTEX_WAKE_PRIVATE, 1) = 0
11305 <... write resumed>)              = 65
11305 exit_group(1 <unfinished ...>
ilya-fedin commented 12 months ago

strace shows kernel syscalls what is completely useless given that this doesn't seem to be a bug with kernel syscalls

ilya-fedin commented 12 months ago

That seem to a bug with communicating between Qt and compositor so perhaps compositor logs may have an evidence. Although this may require enabling some debug logging on compositor side and how to enable it only your compositor devs know...

ilya-fedin commented 12 months ago

The best way is for someone affected to do git bisect on Telegram sources and find the commit that added the bug. That would perhaps be the fastest way to the fix.

aolo2 commented 12 months ago

The same issue (crash on joining/starting a video call or opening video) started happening for me after the Telegram update. I'm not on Qt (i confused Qt with KDE here), but also using Wayland (swaywm/wlroots). Unfortunately I can't git bisect right now, but can try later tonight.

ilya-fedin commented 12 months ago

video call? hm, video call and media viewer are using opengl so I wonder whether disabling opengl helps?

aolo2 commented 12 months ago

Disabling OpenGL doesn't help, sadly. I also confirmed that the issue was introduced between Telegram 4.9.5 (works) and 4.9.6 (doesnt work).

ilya-fedin commented 12 months ago

Have you restarted the client after disabling OpenGL?

aolo2 commented 12 months ago

Yes, as prompted

aolo2 commented 12 months ago

Out of the 4.9.5 -> 4.9.6 commits only a few touch wayland-related code, the main suspect being this sumbodule update: https://github.com/telegramdesktop/tdesktop/commit/289257dd0f2642901cacf52ae91ed21731611233

Maybe someone who has the issue can try building before and after this commit to see if it's it?

ilya-fedin commented 12 months ago

There's only a call to xdg_toplevel_show_window_menu on right click at titlebar and xdg-decoration check on application startup. There's no custom Wayland code on window open afaik, so it should be some change in high-level code that triggers some bug in Qt. So it could be literally any commit.

aolo2 commented 12 months ago

Not strictly relevant to Telegram, but relevant to this issue: since about the same time (can't say exactly) screenshare in all other programs has broken for me as well. I can't screenshare in chrome/firefox etc. Might be a coincidence though.

ilya-fedin commented 12 months ago

How can we get what protocol error exactly happens? I guess answering that question would simplify things a lot.

aolo2 commented 12 months ago

Building in debug mode and setting a breakpoint might give more details that are not printed to stdout?

ilya-fedin commented 12 months ago

Where would you set breakpoint though?

aolo2 commented 12 months ago

Whereever the error is printed and then track it back from there.

ilya-fedin commented 12 months ago

I don't think we can get something helpful with a breakpoint from here? It writes the line from the event loop, not where the error actually happens. https://github.com/qt/qtwayland/blob/v6.5.2/src/client/qwaylanddisplay.cpp#L75

aolo2 commented 12 months ago

I see. Then I guess we need some debug options in wayland/qt/qtwayland/compisotor etc? Like WAYLAND_DEBUG=1

aolo2 commented 12 months ago

Launching Telegram with WAYLAND_DEBUG=1 works and prints this (only showing the last few messages):

[2614717.648]  -> zwp_idle_inhibit_manager_v1@47.create_inhibitor(new id zwp_idle_inhibitor_v1@62, wl_surface@28)
[2614717.762]  -> zxdg_exporter_v2@43.export_toplevel(new id zxdg_exported_v2@45, wl_surface@28)
[2614717.764]  -> wl_display@1.sync(new id wl_callback@67)
[2614717.805] wl_display@1.error(zxdg_exporter_v2@43, 0, "surface must be an xdg_surface")
The Wayland connection experienced a fatal error: Protocol error
ilya-fedin commented 12 months ago

Yeah, try running with that

aolo2 commented 12 months ago

Full log of me opening telegram 4.9.6, clicking on a dialog and pressing the "call" button wayland_debug.log

aolo2 commented 12 months ago

The offending line zxdg_exporter_v2@33.export_toplevel(new id zxdg_exported_v2@35, wl_surface@66) looks suspiciosly like the commit you mentioned "xdg_toplevel_show_window_menu"

ilya-fedin commented 12 months ago

No, it's nowhere related. That's Qt's QWaylandXdgSurface::externWindowHandle() which is used for portal communicaion.

ilya-fedin commented 12 months ago

Looks like display sleep inhibition is created before native window is fully created. Apparently it was silently not working before on Wayland but now it started crashing for some reason.

aolo2 commented 12 months ago

Since you can't reproduce the issue, how do we verify that the fix is working? Would you like me to build from source and test once it's pushed?

ilya-fedin commented 12 months ago

If you can test from sources then yes. If you can't then probably pushing updates with fix attempts until we find the right fix.

aolo2 commented 12 months ago

I can build fine. I just couldn't do git bisect to find the issue since each build takes 10+ minutes on my machine, and it's the middle of a workday.

ilya-fedin commented 12 months ago

Try this then: https://github.com/desktop-app/lib_base/pull/213

Not sure it would help though, I actually fail to understand how that happens. The error looks like inhibitor creation happens after this line but before this line, that's impossible given that all this code is in one function.

If it won't help then I guess we have to unimplement display sleep prevention on Wayland in order to fix the crash.

aolo2 commented 12 months ago

Ok, I'm like 20 minutes into compiling Qt, will report back as soon as I can