wslg: WSLg Crashes Randomly due to multi-thread race condition to access RDP id_manager

Environment

Windows build number: Microsoft Windows NT 10.0.22000.0
Your Distribution version: 20.04
Your WSLg version: 1.0.26

Steps to reproduce

  • Run a ressource heavy GUI application (such as running an Ubuntu VM in virt-manager)
  • Try to use the GUI application and wait for it to crash

WSL logs:

  • Attach WSLg logs from /mnt/wslg

You can access the wslg logs using explorer at: \\wsl$\<Distro-Name>\mnt\wslg (e.g.: \\wsl$\Ubuntu-20.04\mnt\wslg)

Expected behavior

The GUI should at most lag.

Actual behavior

All GUI applications immediately close. Following lines are written to the stderr.log when this happens:

The XKEYBOARD keymap compiler (xkbcomp) reports:
> Internal error:   Could not resolve keysym XF86FullScreen
Errors from xkbcomp are not fatal to the X server
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 569, clipping.
>                   X11 cannot support keycodes above 255.
> Internal error:   Could not resolve keysym XF86FullScreen
Errors from xkbcomp are not fatal to the X server
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 569, clipping.
>                   X11 cannot support keycodes above 255.
> Internal error:   Could not resolve keysym XF86FullScreen
Errors from xkbcomp are not fatal to the X server
[11:01:14:170] [340:340] [ERROR][com.freerdp.core.transport] - BIO_read returned a system error 11: Resource temporarily unavailable
[11:01:14:170] [340:340] [ERROR][com.freerdp.core] - transport_read_layer:freerdp_set_last_error_ex ERRCONNECT_CONNECT_TRANSPORT_FAILED [0x0002000D]
[11:01:14:171] [340:340] [ERROR][com.freerdp.core.transport] - BIO_should_retry returned a system error 32: Broken pipe
[11:01:14:171] [340:340] [ERROR][com.freerdp.core.transport] - BIO_should_retry returned a system error 32: Broken pipe
[11:01:14:174] [340:340] [ERROR][com.freerdp.core.transport] - BIO_should_retry returned a system error 32: Broken pipe
[11:01:14:174] [340:340] [ERROR][com.freerdp.core.transport] - BIO_should_retry returned a system error 32: Broken pipe
[11:01:14:229] [340:340] [ERROR][com.freerdp.core.transport] - BIO_should_retry returned a system error 32: Broken pipe
[11:01:14:229] [340:340] [ERROR][com.freerdp.core.transport] - BIO_should_retry returned a system error 32: Broken pipe
(EE) failed to read Wayland events: Broken pipe
<4>WSLGd: /usr/bin/weston terminated with signal 11.
<4>WSLGd: /mnt/c/Windows/System32/mstsc.exe exited with status 0.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 19 (6 by maintainers)

Most upvoted comments

@hideyukn88 By the way, is there a quick workaround to restart the graphics subsystem without restarting the whole WSL?

@hideyukn88 thank you for the prompt response! Will wait for the fix.

@speller, thank you very much for sharing the dump, For reference, below is the callstack for the crash and I will work on the fix, thanks again for reporting the issue!

(gdb) bt
#0  0x00007fbd64baee6c in __pthread_kill_implementation () at /lib/libc.so.6
#1  0x00007fbd64b63d86 in raise () at /lib/libc.so.6
#2  0x00007fbd64b4e7e5 in abort () at /lib/libc.so.6
#3  0x00007fbd64b4e71b in _nl_load_domain.cold () at /lib/libc.so.6
#4  0x00007fbd64b5cc36 in  () at /lib/libc.so.6
#5  0x00007fbd6116fb78 in rdp_id_manager_lookup (id=187, id_manager=0x563bc8ed6320) at ../libweston/backend-rdp/rdputil.c:300
#6  rdp_id_manager_allocate_id
    (id_manager=id_manager@entry=0x563bc8ed6320, object=object@entry=0x563bc9603d10, new_id=new_id@entry=0x7fffb4a5c358)
    at ../libweston/backend-rdp/rdputil.c:330
#7  0x00007fbd61169b69 in rdp_rail_create_window (listener=<optimized out>, data=0x563bc9603d10)
    at ../libweston/backend-rdp/rdprail.c:1465
#8  0x00007fbd64af4d09 in wl_signal_emit (data=0x563bc9603d10, signal=0x563bc8e19758) at /usr/include/wayland-server-core.h:481
#9  compositor_create_surface (client=0x563bc8e4fa50, resource=<optimized out>, id=439) at ../libweston/compositor.c:3906
#10 0x00007fbd6481a056 in ffi_call_unix64 () at /lib/libffi.so.8
#11 0x00007fbd64818a56 in ffi_call_int () at /lib/libffi.so.8
#12 0x00007fbd64abdf61 in wl_closure_invoke () at /lib/libwayland-server.so.0
#13 0x00007fbd64ab9202 in wl_client_connection_data () at /lib/libwayland-server.so.0
#14 0x00007fbd64abbdca in wl_event_loop_dispatch () at /lib/libwayland-server.so.0
#15 0x00007fbd64ab9955 in wl_display_run () at /lib/libwayland-server.so.0
#16 0x00007fbd64d35337 in wet_main (argc=<optimized out>, argv=0x7fffb4a5d2c8) at ../compositor/main.c:3612
#17 0x00007fbd64b4f57d in __libc_start_call_main () at /lib/libc.so.6
#18 0x00007fbd64b4f630 in __libc_start_main_impl () at /lib/libc.so.6
#19 0x0000563bc8127085 in _start ()