Versions: krdp 6.8.0, Plasma 6.8.0, freerdp 3.32.2, CachyOS (Arch-based), Wayland, NVIDIA. In portal mode (no --plasma), the first RDP connection after the service starts works. Later connections authenticate, and the encoder starts. The client then drops the connection within about a second, and the Windows App on macOS shows error 0x200d. Reconnecting worked on 6.7.5 with the same client. I reproduced this four times. The server logs this on each failing connection: rdpgfx_server_handle_messages: WTSVirtualChannelRead failed transport_read_layer: ERRCONNECT_CONNECT_TRANSPORT_FAILED [0x0002000D] The VAAPI probe lines appear only for the first connection a process handles. In portal mode the server also logs this at startup: "Failed to register with host portal ... Connection already associated with an application ID". The --plasma startup does not log it. I bisected one variable at a time, testing the second connection in the same server process: portal, freerdp 3.32.2 fails portal, Windows App quit and reopened fails portal, freerdp 3.31.1 fails --plasma, freerdp 3.32.2 works, repeated reconnects fine freerdp and the client are cleared. The fault sits in the portal capture path, in either krdp's PortalSession or xdg-desktop-portal-kde 6.8.0, and both changed in 6.8. My bisect does not separate them. Running krdpserver --plasma works around it.
Independent reproduction on a second machine, plus the cause. Setup: CachyOS, krdp 6.8.0, Plasma 6.8.0 (kwin, xdg-desktop-portal-kde, kpipewire 6.8.0), FreeRDP 3.32.2, Qt 6.12.0, kernel 7.2.9, Wayland, NVIDIA RTX 2080 Ti (580.178.04, no VA-API H.264 encode, so libx264). Server started as `krdpserver --virtual-monitor 1800x1169@1 -u … -p …` (portal path). Client: Windows App 11.4.2 on macOS 27.0.1. Reconnects worked on krdp 6.7.5 with the same client. == Symptom == First connection after krdpserver starts works. Every later connection authenticates, the portal session starts, the encoder starts, and the client drops the TCP connection about 6 ms after the first frame. Windows App shows 0x200d. Server side: transport_read_layer: BIO_read retries exceeded transport_read_layer: ERRCONNECT_CONNECT_TRANSPORT_FAILED [0x0002000D] rdpgfx_server_handle_messages: WTSVirtualChannelRead failed! rdpgfx_server_thread_func: rdpgfx_server_handle_messages failed with error 1359 Those are the effect of the client hanging up, not the cause: `org.kde.krdp` debug logging shows no krdp warning before them, and the portal session reports "Started Freedesktop Portal session" normally each time. Same result with KRDP_DISABLE_H264=1 (progressive codec), so the codec is not involved. A second connection from sdl-freerdp3 (FreeRDP 3.32.2 client, same server process) works, so the client matters: FreeRDP tolerates what the server sends, Windows App does not. == Cause: uninitialised Surface in VideoStreamSurface == With WLOG_LEVEL=DEBUG, WLOG_FILTER=com.freerdp.channels.rdpgfx.server:TRACE on the server, the GFX PDUs the server sends at the first frame differ between the first and the second connection of the same process: First connection (works): rdpgfx_send_caps_confirm_pdu rdpgfx_send_reset_graphics_pdu rdpgfx_send_create_surface_pdu rdpgfx_send_map_surface_to_output_pdu rdpgfx_send_start_frame_pdu / surface_command / end_frame_pdu ... FRAMEACKNOWLEDGE, session runs Second connection (fails): rdpgfx_send_caps_confirm_pdu rdpgfx_send_delete_encoding_context_pdu <-- for a surface that was never created rdpgfx_send_delete_surface_pdu <-- same rdpgfx_send_reset_graphics_pdu rdpgfx_send_create_surface_pdu rdpgfx_send_map_surface_to_output_pdu rdpgfx_send_start_frame_pdu / surface_command / end_frame_pdu (6 ms later) transport_read_pdu() -1, client gone DeleteEncodingContext and DeleteSurface before any CreateSurface is exactly what `VideoStream::destroySurface()` emits when `d->surface->surface.id != 0` and `codecContextId != 0` at the top of the first `performReset()`. On a fresh connection both must be 0. They are not, because they are never initialised: src/VideoStreamSurface.h (Plasma/6.8 and master): struct Surface { uint16_t id; uint32_t codecContextId; QSize size; }; ... class VideoStreamSurface : public QObject { ... Surface surface; // no initialiser ... }; src/VideoStreamSurface.cpp: VideoStreamSurface::VideoStreamSurface(VideoStream *stream) : QObject(stream) , m_stream(stream) { } `Surface` has no default member initialisers and the constructor does not value-initialise `surface`, so `id` and `codecContextId` are indeterminate. The first VideoStreamSurface of the process usually lands on fresh (zeroed) heap pages, so it works. Later ones reuse freed memory and inherit garbage, so `destroySurface()` sends DeleteEncodingContext/DeleteSurface for bogus ids before ResetGraphics. Windows App treats a DeleteSurface for an unknown surfaceId as a protocol error and disconnects; FreeRDP-based clients only warn. That also explains why it looked like a portal-vs-plasma difference (different heap layout) and why nothing in PortalSession or xdg-desktop-portal-kde logs an error. The struct came in with 50120646 "Introduce a separate VideoStreamSurface object" (2026-09-08), which is why 6.7.5 is fine. 6.8.1 (d6b12bf5, 6d453c86) only touches authentication settings and does not change this. Suggested fix (either line is enough): - Surface surface; + Surface surface{}; or give the struct defaults: struct Surface { uint16_t id = 0; uint32_t codecContextId = 0; QSize size; }; `VideoStream::destroySurface()` already resets with `surface = Surface{}` after use, so only the initial state is wrong. == Repro == 1. `krdpserver --virtual-monitor 1800x1169@1 -u user -p pass` (plain portal mode without --virtual-monitor fails the same way for the other reporter). 2. Connect with Windows App (macOS 11.4.2 here), wait, disconnect. 3. Connect again: 0x200d within a second. Every further attempt fails until krdpserver restarts. 4. Optional: WLOG_LEVEL=DEBUG WLOG_APPENDER=JOURNALD WLOG_FILTER=com.freerdp.channels.rdpgfx.server:TRACE shows the two delete PDUs on connection 2. (Without the JOURNALD appender FreeRDP's console log is block-buffered under systemd and the lines appear only on the next flush.) == Workaround in use == A systemd --user unit that follows the krdpserver journal and restarts the service 2 s after each session ends (match on "ERRINFO_LOGOFF_BY_USER [" or "ERRCONNECT_CONNECT_TRANSPORT_FAILED"). --plasma is not an option with --virtual-monitor on 6.8.0 because of the pointer offset problem (bug 526783).
Thank you, @desislav.lesov, for the analysis. I hit the same 0x200d on my machine during additional testing, and your explanation of the uninitialized Surface members matched what I found in the source. Your suggested fix works. Here are my results, in case they help whoever picks this up. The bug also appears with --plasma, so portal mode is not the trigger. I tested krdpserver 6.8.0 with --plasma --mode RemoteAccess and Windows App on macOS. To reproduce it on demand, set MALLOC_PERTURB_=85 and GLIBC_TUNABLES=glibc.malloc.tcache_count=0. MALLOC_PERTURB_ by itself does nothing here, because glibc recycles the 104-byte VideoStreamSurface through its tcache without filling it. Turning the tcache off lets the perturb fill every allocation with 0xAA. Unfixed build: I added a log line at the top of destroySurface(). The first call prints id=43690 (0xAAAA) and codecContextId=2863311530 (0xAAAAAAAA). The client drops 9 ms later with ERRCONNECT_CONNECT_TRANSPORT_FAILED [0x0002000D] after "rdpgfx_server_handle_messages: WTSVirtualChannelRead failed", and Windows App shows 0x200d. Fixed build: with your default initializers on the two members, three connect and disconnect cycles in a row ran clean under the same settings. --- a/src/VideoStreamSurface.h +++ b/src/VideoStreamSurface.h struct Surface { - uint16_t id; - uint32_t codecContextId; + uint16_t id = 0; + uint32_t codecContextId = 0; QSize size; }; Without perturb, the first destroySurface() sees id=0 and the connection works. A same-size test object in a standalone program read a stale 0x0007 from the previous object with perturb alone, and 0xaaaa with both settings. That fits the intermittent reports: a reused block holds either a stale id or zero, depending on what ran before. For the same reason --plasma gives no workaround. The heap contents decide whether a connection fails. Thanks for tracking this down.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/krdp/-/merge_requests/269
Git commit a08961e64dd85d80681acdb3d6d3fb9ef1d6818c by Oliver Beard. Committed on 19/10/2026 at 20:05. Pushed by olib into branch 'master'. VideoStreamSurface: Initialize struct members Otherwise, we may (and actually do) interact with an uninitialised struct, eventually running afoul of stricter RDP client implementations. Fixes a failure where subsequent connections to the server fail with MSTSC (Windows Remote Desktop Connection). Thanks to Desislav for determining this on Bugzilla. FIXED-IN: 6.8.1 M +2 -2 src/VideoStreamSurface.h https://invent.kde.org/plasma/krdp/-/commit/a08961e64dd85d80681acdb3d6d3fb9ef1d6818c
Git commit 05c49da0857be6ea182f659df3cd7ffcfb0c0875 by Oliver Beard. Committed on 19/10/2026 at 20:17. Pushed by olib into branch 'Plasma/6.8'. VideoStreamSurface: Initialize struct members Otherwise, we may (and actually do) interact with an uninitialised struct, eventually running afoul of stricter RDP client implementations. Fixes a failure where subsequent connections to the server fail with MSTSC (Windows Remote Desktop Connection). Thanks to Desislav for determining this on Bugzilla. FIXED-IN: 6.8.1 (cherry picked from commit a08961e64dd85d80681acdb3d6d3fb9ef1d6818c) Co-authored-by: Oliver Beard <olib141@outlook.com> M +2 -2 src/VideoStreamSurface.h https://invent.kde.org/plasma/krdp/-/commit/05c49da0857be6ea182f659df3cd7ffcfb0c0875