Xpra-org / xpra

Persistent remote applications for X11; screen sharing for X11, MacOS and MSWindows.
https://xpra.org/
GNU General Public License v2.0
1.99k stars 169 forks source link

Server sends corrupted/wrong tray icons #4403

Closed Voros-Roka closed 1 month ago

Voros-Roka commented 1 month ago

Describe the bug When connecting to a xpra server the server sends wrong and corrupted tray icons to the client.

To Reproduce Steps to reproduce the behavior:

  1. server command: xpra start :0 --uid=1000 --gid=1000 --mdns=no --exit-with-client=no --exit-with-children=no --exit-with-windows=no --daemon=no --mmap=/sys/devices/pci0000:00/0000:00:08.0/resource2_wc --bind-vsock=auto:2000
  2. client command: XPRA_USE_NATIVE_TRAY=0 xpra attach vsock://4:2000 --mmap=/dev/shm/my-ivshmem --border=red,8 --opengl=no --sharing=yes
  3. start any program on the server that would show a tray icon on the client. To reproduce the corrupted icon the program has to be able to change the icon to different ones and most likely use transparent icons

System Information (please complete the following information):

Additional context The server runs with xdummy inside a qemu vm. LightDM is the display manager and AwesomeWM the window manager both on server and client. There is no compositing involved. It does not matter if mmap is used or not and the client version itself too has no impact. To track down the cause of the corruption i started to test different versions of xpra as server and created the following list with commits, versions and if the server sends corrupted icons:

Commit Version Corrupt?
24971bb28b 6.0.2 No
d7e57a2057 6.1.3 No
93e7231a73 6.2.0 No
61c94c2b07 6.2.0 No
1f244bdb32 6.2.0 No
67ca44380d 6.2.0 N/A (no Icons)
fd698cd404 6.2.0 Yes
75d2762385 6.2.0 Yes

In issue https://github.com/Xpra-org/xpra/issues/4401 it was speculated that either commit 61c94c2b07 or 67ca44380d could be the culprit. According to the tests, 61c94c2b07 does not cause the server to send corrupt icons. I could not test 67ca44380d directly because no icons showed up but fd698cd404 , according to the commit message fixes the problem. Testing fd698cd404 showed the corrupted icons! Something between 61c94c2b07 and fd698cd404 changed, and like speculated 67ca44380d (or fd698cd404) is the most likely candidate.

Here is what i observerd: The following icon is shown first (BirdTray did not find a running thunderbird process) thunderbird_X Then as soon as thunderbird is started BirdTray tries to show the following icon with transparent background tray_thunderbird_normal but instead of replacing the complete icon the following happens tray_thunderbird_error It seems that only the non-transparent parts of the icon get updated and everything under the transparent parts that is already there stays in the pixel buffer that is send to the client. I had a look at the possible commits but i did not see anything obvious.

Log from server with corrupted icons and "-d tray" ``` WARNING: low display number: 0 You are attempting to run the xpra server against a low X11 display number: ':0' This is generally not what you want. You should probably use a higher display number just to avoid any confusion and this warning message. 2024-10-25 15:33:34,170 Error: pam_open_session failed: 28 2024-10-25 15:33:34,171 b'Module is unknown' 2024-10-25 15:33:34,272 Error: cannot enable SSH socket upgrades 2024-10-25 15:33:34,273 `paramiko` module not found 2024-10-25 15:33:34,326 no uinput module (not usually needed) X.Org X Server 1.21.1.13 X Protocol Version 11, Revision 0 Current Operating System: Linux artix-live 6.11.5-artix1-1 #1 SMP PREEMPT_DYNAMIC Wed, 23 Oct 2024 16:27:25 +0000 x86_64 Kernel command line: BOOT_IMAGE=/boot/vmlinuz-x86_64 audit=1 lsm=landlock,lockdown,yama,integrity,apparmor,bpf lang=en_US keytable=us tz=UTC label=ARTIX_202410 overlay=livefs Current version of pixman: 0.43.4 Before reporting problems, check http://wiki.x.org to make sure that you have the latest version. Markers: (--) probed, (**) from config file, (==) default setting, (++) from command line, (!!) notice, (II) informational, (WW) warning, (EE) error, (NI) not implemented, (??) unknown. (++) Log file: "/run/user/1000/xpra/0/Xorg.log", Time: Fri Oct 25 15:33:34 2024 (++) Using config file: "/etc/xpra/xorg.conf" (==) Using system config directory "/usr/share/X11/xorg.conf.d" pci id for fd 13: 1234:1111, driver (null) 2024-10-25 15:33:36,526 debug enabled for ['xpra.platform.posix.gui', 'posix', 'tray'] 2024-10-25 15:33:36,597 debug enabled for ['xpra.x11.gtk.tray', 'x11', 'tray'] 2024-10-25 15:33:37,184 debug enabled for ['xpra.x11.server.seamless', 'server', 'tray'] 2024-10-25 15:33:37,229 pointer device emulation using XTest 2024-10-25 15:33:37,321 wrote pid 2595 to '/run/user/1000/xpra/0/server.pid' 2024-10-25 15:33:37,326 Error: cannot find the html web root 2024-10-25 15:33:37,326 '/usr/share/xpra/www' does not exist 2024-10-25 15:33:37,326 install the `xpra-html5` package 2024-10-25 15:33:37,326 or turn off the builtin web server using `html=no` 2024-10-25 15:33:40,013 some GStreamer elements are missing or unavailable on this system: 2024-10-25 15:33:40,014 vah264lpenc, vah264enc, vaapih264enc, vaapih265enc, openh264enc 2024-10-25 15:33:40,079 cannot create group socket '/run/xpra/artix-live-0' 2024-10-25 15:33:40,079 [Errno 13] Permission denied 2024-10-25 15:33:40,079 created unix domain sockets: 2024-10-25 15:33:40,080 '/run/user/1000/xpra/artix-live-0' 2024-10-25 15:33:40,080 '/home/artix/.xpra/artix-live-0' 2024-10-25 15:33:40,080 '/run/user/1000/xpra/0/socket' 2024-10-25 15:33:40,080 created abstract sockets: 2024-10-25 15:33:40,080 '@xpra/0' 2024-10-25 15:33:40,081 xvfb pid 2695 2024-10-25 15:33:40,180 setting dummy crtc and output 0 to: 2024-10-25 15:33:40,180 8192x4096 50Hz (1445x722 mm, dpi=144) 2024-10-25 15:33:40,184 monitor 0 is 'VFB-0' 8192x4096 2024-10-25 15:33:40,239 D-Bus notification forwarding is available 2024-10-25 15:33:40,265 pulseaudio server started with pid 3012 2024-10-25 15:33:40,265 private server socket path: 2024-10-25 15:33:40,265 '/run/user/1000/xpra/0/pulse/pulse/native' 2024-10-25 15:33:40,330 watching for applications menu changes in: 2024-10-25 15:33:40,330 '/usr/share/applications' 2024-10-25 15:33:40,331 using 'Gio file monitor' 2024-10-25 15:33:40,586 Warning: webcam forwarding is disabled 2024-10-25 15:33:40,586 the virtual video directory '/sys/devices/virtual/video4linux' was not found 2024-10-25 15:33:40,586 make sure that the 'v4l2loopback' kernel module is installed and loaded 2024-10-25 15:33:40,587 or use the 'webcam=no' option 2024-10-25 15:33:40,587 found 0 virtual video devices for webcam forwarding 2024-10-25 15:33:40,642 setup tray: current selection owner=0 2024-10-25 15:33:40,643 tray dock window: {visualid=} geometry=(0, 0, 1, 1, 0, 24) 2024-10-25 15:33:40,645 setup tray: set selection owner returned 1, owner=200010 2024-10-25 15:33:40,646 setup tray: sending client message with time=34470 2024-10-25 15:33:40,646 setup tray: done 2024-10-25 15:33:40,798 GStreamer version 1.24.8 2024-10-25 15:33:40,825 xpra is ready. 2024-10-25 15:33:40,826 xpra X11 seamless server version 6.2.0-r0 2024-10-25 15:33:40,828 uid=1000 (artix), gid=1000 (artix) 2024-10-25 15:33:40,828 running with pid 2595 on Linux Artix rolling 2024-10-25 15:33:40,828 cpython 3.12 2024-10-25 15:33:40,988 connected to X11 display :0 with 24 bit colors 2024-10-25 15:33:41,110 7.8GB of system memory 2024-10-25 15:33:41,150 No OpenGL_accelerate module loaded: No module named 'OpenGL_accelerate' 2024-10-25 15:33:41,312 Warning: icon loop failure for gnome-util in matefaenza 2024-10-25 15:33:41,312 '<' not supported between instances of 'NoneType' and 'int' 2024-10-25 15:33:41,313 this is likely to be this bug in pyxdg: 2024-10-25 15:33:41,313 https://github.com/takluyver/pyxdg/pull/20 2024-10-25 15:33:42,694 loaded 38 start menu entries from 7 sub-menus in 2.2 seconds 2024-10-25 15:33:44,538 OpenGL is supported on display ':0' 2024-10-25 15:33:44,538 using 'llvmpipe (LLVM 18.1.8, 256 bits)' renderer 2024-10-25 15:34:39,961 New vsock connection received 2024-10-25 15:34:39,961 from '2:3544825554' 2024-10-25 15:34:39,961 on '4294967295:2000' 2024-10-25 15:34:39,966 Handshake complete; enabling connection 2024-10-25 15:34:40,025 mmap is enabled using 2GB area in /sys/devices/pci0000:00/0000:00:08.0/resource2_wc 2024-10-25 15:34:40,026 Python/GTK3 Linux Artix rolling X11 client version 6.2 2024-10-25 15:34:40,026 OpenGL is disabled 2024-10-25 15:34:40,124 setting key repeat rate from client: 660ms delay / 40ms interval 2024-10-25 15:34:40,127 setting keymap: rules=evdev, model=pc105, layout=us 2024-10-25 15:34:40,246 client root window size is 10880x2400 2024-10-25 15:34:40,248 :0.0 (1462x321 mm - DPI: 189x190) 2024-10-25 15:34:40,248 SAM DP-4 3840x2160 at 0x0 (632x360 mm - DPI: 154x152) workarea: 3840x2160 2024-10-25 15:34:40,248 SAM DP-2 3840x2160 at 3840x0 (632x360 mm - DPI: 154x152) workarea: 3840x2160 at 3840x0 2024-10-25 15:34:40,248 WAC DP-1 3200x2400 at 7680x0 (432x324 mm - DPI: 188x188) workarea: 3200x2400 at 7680x0 2024-10-25 15:34:40,261 setting dummy crtc and output 0 to: 2024-10-25 15:34:40,261 3840x2160 60Hz (632x360 mm, dpi=154x152) 2024-10-25 15:34:40,264 setting dummy crtc and output 1 to: 2024-10-25 15:34:40,265 3200x2400 60Hz (432x324 mm, dpi=188) at 7680,0 2024-10-25 15:34:40,267 setting dummy crtc and output 2 to: 2024-10-25 15:34:40,267 3840x2160 60Hz (632x360 mm, dpi=154x152) at 3840,0 2024-10-25 15:34:40,270 monitor 0 is 'SAM DP-4' 3840x2160 2024-10-25 15:34:40,271 monitor 1 is 'WAC DP-1' 3200x2400 2024-10-25 15:34:40,271 monitor 2 is 'SAM DP-2' 3840x2160 2024-10-25 15:34:40,296 client 1 @07.051 Xpra X11 seamless server version 6.2 2024-10-25 15:34:40,347 sent updated screen size to 1 clients: 10880x4096 (max 10880x4320) 2024-10-25 15:34:40,383 client 1 @07.141 Attached to xpra server at vsock://4:2000 2024-10-25 15:34:40,383 client 1 @07.141 (press Control-C to detach) 2024-10-25 15:34:40,402 client 1 @07.161 running 2024-10-25 15:34:40,493 setting keymap: rules=evdev, model=pc105, layout=us 2024-10-25 15:34:40,677 using pulseaudio device: 2024-10-25 15:34:40,677 'Monitor of Xpra Speaker' 2024-10-25 15:34:41,616 audio capture using 'opus' audio codec 2024-10-25 15:34:57,323 started command `pcmanfm` with pid 3140 2024-10-25 15:34:57,324 wrote pid 3140 to '/run/user/1000/xpra/0/File.pid' 2024-10-25 15:35:05,727 started command `/bin/alacritty` with pid 3148 2024-10-25 15:35:05,727 wrote pid 3148 to '/run/user/1000/xpra/0/Alacritty.pid' 2024-10-25 15:35:06,213 client 1 @32.969 Warning: cannot handle window transparency 2024-10-25 15:35:06,214 client 1 @32.970 screen is not composited 2024-10-25 15:35:06,214 client 1 @32.972 Warning: window 0x2 changed its transparency attribute 2024-10-25 15:35:06,214 client 1 @32.972 from False to True, behaviour is undefined 2024-10-25 15:35:50,706 started command `birdtray` with pid 3202 2024-10-25 15:35:50,708 wrote pid 3202 to '/run/user/1000/xpra/0/Birdtray.pid' 2024-10-25 15:35:51,205 tray docking request from 0x1200006 2024-10-25 15:35:51,205 dock_tray(1200006) 2024-10-25 15:35:51,206 tray geometry=22x22 2024-10-25 15:35:51,206 adjusted geometry=(0, 0, 22, 22, 0, 24), title='birdtray' 2024-10-25 15:35:51,208 tray: recording corral window 2000f3, setting tray properties 2024-10-25 15:35:51,208 showing tray window, resizing and reparenting 2024-10-25 15:35:51,209 redrawing new tray container window 2000f3 2024-10-25 15:35:51,209 dock_tray(1200006) done, sending xembed notification 2024-10-25 15:35:51,215 debug enabled for ['xpra.x11.models.systray', 'x11', 'window', 'tray'] 2024-10-25 15:35:51,240 systray SystemTrayWindowModel(1200006) configured to: (3221, 2113, 64, 64) 2024-10-25 15:35:51,240 SystemTrayModel.move_resize(3221, 2113, 64, 64) 2024-10-25 15:35:51,322 systray SystemTrayWindowModel(1200006) configured to: (3597, 2113, 47, 47) 2024-10-25 15:35:51,322 SystemTrayModel.move_resize(3597, 2113, 47, 47) 2024-10-25 15:35:52,236 systray SystemTrayWindowModel(1200006) configured to: (3597, 2113, 47, 47) 2024-10-25 15:35:52,236 SystemTrayModel.move_resize(3597, 2113, 47, 47) ```
totaam commented 1 month ago

I can reproduce the problem, without using mmap, vsock, XPRA_USE_NATIVE_TRAY or anything fancy! Just using the tray test app from xpra toolbox and an MS Windows client.

totaam commented 1 month ago

Adding some debug logging to xpra 6.1.x server, I see that the visual chosen by Gtk using Gdk.Screen.get_rgba_visual is (from xdpyinfo):

  visual:
    visual id:    0x439
    class:    TrueColor
    depth:    32 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits

With newer versions, we end up choosing:

  default visual id:  0x21
  visual:
    visual id:    0x21
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits

Sounds like a simple fix, but it was not: ce124c6415d1e1a57a7c4fe5e36158e2eb3f926e

This will be included in 6.2.1

Voros-Roka commented 1 month ago

Can confirm that ce124c6 fixes the corrupted icons here too!