microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
9.9k stars 296 forks source link

Copying big text from WSLg to Windows host crashes the entire WSLg #1258

Open speller opened 1 week ago

speller commented 1 week ago

Windows build number:

22631.0

Your Distribution version:

22.04

Your WSL versions:

WSL version: 2.2.4.0 Kernel version: 5.15.153.1-2 WSLg version: 1.0.61 MSRDC version: 1.2.5326 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.26091.1-240325-1447.ge-release Windows version: 10.0.22631.3807

Steps to reproduce:

  1. Copy a long text more than 400KB in WSLg (I tried PHPStorm IDE)
  2. Paste it anywhere in the Windows host app (I tried notepad and chrome browser)

WSL logs:

Crash at 11:53:

weston.log:

[11:51:54.098] Client: ClientGetAppidReq: pid:71328 appId:gcr-prompter WindowId:0x22
[11:51:55.179] !!!cursor role is added after creation - WindowId:0x21
[11:51:55.179] cursor surface already exists old 0x55d1fe268a60 vs new 0x55d1fe3aa420
[11:52:45.934] Client: ClientGetAppidReq: WindowId:0x24 does not have appId, or not top level window.
[11:52:54.029] Client: ClientGetAppidReq: WindowId:0x25 does not have appId, or not top level window.
[11:52:55.006] Client: ClientGetAppidReq: WindowId:0x26 does not have appId, or not top level window.
[11:52:55.577] Client: ClientGetAppidReq: WindowId:0x27 does not have appId, or not top level window.
[11:52:56.145] Client: ClientGetAppidReq: WindowId:0x28 does not have appId, or not top level window.
[11:52:57.220] Client: ClientGetAppidReq: WindowId:0x29 does not have appId, or not top level window.
[11:53:01.139] Client: ClientGetAppidReq: WindowId:0x2a does not have appId, or not top level window.
[11:53:01.967] Client: ClientGetAppidReq: WindowId:0x2b does not have appId, or not top level window.
[11:53:02.563] Client: ClientGetAppidReq: WindowId:0x2c does not have appId, or not top level window.
[11:53:22.351] set_position_from_xwayland: XWM 0, 0; geometry 32, 32; view -32, -32
[11:53:22.412] rdp_rail_notify_app_list(): rdp_peer 0x55d1fdf27f40
[11:53:22.412]     inSync: 0
[11:53:22.412]     syncStart: 0
[11:53:22.412]     syncEnd: 0
[11:53:22.412]     newAppId: 0
[11:53:22.412]     deleteAppId: 0
[11:53:22.412]     deleteAppProvider: 0
[11:53:22.412]     associateWindowId: 1
[11:53:22.412]     appId: jetbrains-phpstorm
[11:53:22.412]     appGroup: (null)
[11:53:22.412]     appExecPath: (null)
[11:53:22.412]     appWorkingDir: (null)
[11:53:22.412]     appDesc: jetbrains-phpstorm
[11:53:22.412]     appIcon: (nil)
[11:53:22.412]     appProvider: (null)
[11:53:22.412]     appWindowId: 0x2d
[11:53:22.413] Client: ClientGetAppidReq: pid:70655 appId:jetbrains-phpstorm WindowId:0x2d
[11:53:25.035] Client: ClientGetAppidReq: WindowId:0x2e does not have appId, or not top level window.
[11:53:32.211] xfixes selection notify event: owner 10485796
[11:53:32.218] wrote fd:107 65536 (chunk size 65536) of 262040 bytes
[11:53:32.218] wrote fd:107 73728 (chunk size 8192) of 262040 bytes
[11:53:32.218] wrote fd:107 98304 (chunk size 24576) of 262040 bytes
[11:53:32.218] wrote fd:107 163840 (chunk size 65536) of 262040 bytes
[11:53:32.218] wrote fd:107 229376 (chunk size 65536) of 262040 bytes
[11:53:32.218] wrote fd:107 262040 (chunk size 32664) of 262040 bytes
[11:53:32.222] wrote fd:110 65536 (chunk size 65536) of 232429 bytes
[11:53:32.222] wrote fd:110 77824 (chunk size 12288) of 232429 bytes
[11:53:32.223] wrote fd:110 126976 (chunk size 49152) of 232429 bytes
[11:53:32.223] wrote fd:110 192512 (chunk size 65536) of 232429 bytes
[11:53:32.223] wrote fd:110 232429 (chunk size 39917) of 232429 bytes
[11:53:32.223] transfer write complete (zero size reply)
[11:53:32.223] write error to target fd:-1 start:0 reminder:0 Bad file descriptor
[11:53:32.228] wrote fd:110 65536 (chunk size 65536) of 232429 bytes
[11:53:32.228] wrote fd:110 77824 (chunk size 12288) of 232429 bytes
[11:53:32.228] wrote fd:110 126976 (chunk size 49152) of 232429 bytes
[11:53:32.228] wrote fd:110 192512 (chunk size 65536) of 232429 bytes
[11:53:32.228] wrote fd:110 232429 (chunk size 39917) of 232429 bytes
[11:53:32.229] transfer write complete (zero size reply)
[11:53:32.230] write error to target fd:-1 start:0 reminder:232429 Bad file descriptor
[11:53:32.230] write error to target fd:-1 start:0 reminder:232429 Bad file descriptor
[11:53:47.006] wrote fd:110 4 (chunk size 4) of 4 bytes
[11:53:47.006] wrote fd:110 0 (chunk size 0) of 0 bytes
[11:53:47.006] transfer write complete
Date: 2024-06-21 JST
[11:53:47.270] weston 9.0.0
               https://wayland.freedesktop.org
               Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
               Build: 9.0.0-210-gf227edd6
[11:53:47.270] Command line: /usr/bin/weston --backend=rdp-backend.so --modules=wslgd-notify.so --xwayland --socket=wayland-0 --shell=rdprail-shell.so --log=/mnt/wslg/weston.log --logger-scopes=log,rdp-backend,rdprail-shell
[11:53:47.270] OS: Linux, 5.15.153.1-microsoft-standard-WSL2, #1 SMP Fri Mar 29 23:14:13 UTC 2024, x86_64
[11:53:47.270] Using config file '/home/wslg/.config/weston.ini'
[11:53:47.270] Output repaint window is 7 ms maximum.
[11:53:47.270] Loading module '/usr/lib/libweston-9/rdp-backend.so'
[11:53:47.271] using FreeRDP version 2.4.0

stderr.log:

The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 569, clipping.
>                   X11 cannot support keycodes above 255.
Errors from xkbcomp are not fatal to the X server
weston: ../libweston/backend-rdp/rdpclip.c:214: clipboard_process_text_utf8: Assertion `data_contents.size == (data_size_in_char * 2)' failed.
(EE) failed to read Wayland events: Broken pipe
[11:53:47.262] <5>WSLGd: Run:110: pid 69452 terminated with signal 6, /usr/bin/sh -c /usr/bin/weston --backend=rdp-backend.so --modules=wslgd-notify.so --xwayland --socket=wayland-0 --shell=rdprail-shell.so --log=/mnt/wslg/weston.log --logger-scopes=log,rdp-backend,rdprail-shell 
[11:53:47.712] <5>WSLGd: Run:108: pid 69454 exited with status 0, /init /mnt/c/Program Files/WSL/msrdc.exe msrdc.exe /wslg /silent /v:AFC47FAE-B738-4322-B858-3ABA9CE70683 /hvsocketserviceid:00000003-FACB-11E6-BD58-64006A7986D3 /plugin:WSLDVC_PACKAGE /wslgsharedmemorypath:WSL\AFC47FAE-B738-4322-B858-3ABA9CE70683\wslg C:\Program Files\WSL\wslg.rdp 

WSL dumps:

Attached to feedback-hub:?contextid=677&feedbackid=afc96629-6abc-4ee9-b06e-e30092eea37e&form=1&src=1

Expected behavior:

Text is pasted

Actual behavior:

WSLg crashes, apps are not restored on WSLg restart (WSLg apps get killed as well).