#3884·xrdp

mstsc reports protocol error 0xd06 when a session is logged off (not EGFX-related; server sends ERRINFO_LOGOFF_BY_USER)

Author: MAButzCreated Sep 22, 2026Updated Sep 23, 2026

Summary

When a user logs off, mstsc.exe closes with "Die Verbindung zum Remotecomputer wurde getrennt" and error code 0xd06 (the protocol-error code). xfreerdp3 against the same server, same session type, exits silently.

The existing 0xd06 reports (#3128, #3571, #246, #1661) are all about connection setup. This one is about teardown, and reproduces with max_bpp=32 and a 1920x1080 client, so none of those apply.

The server thinks it is doing the right thing: it sends ERRINFO_LOGOFF_BY_USER, which is what a Windows server sends there. So this is about what happens after that.

Environment

OS Debian 13 (trixie), Xorg 21.1.16
xrdp 0.10.6.1-2~bpo13+1 (Debian backports) and 0.10.80 (devel)
Client (fails) mstsc, Windows 11
Client (fine) xfreerdp3
xrdp.ini max_bpp=32, security_layer=negotiate, TLS 1.3 established

The 0.10.80 build carries local patches (PR #3883 plus a third-party VA-API branch) and two temporary LOG_LEVEL_INFO lines I added for this investigation — those are marked below. The teardown pattern itself is identical on the unmodified-in-this-area 0.10.6.1 package.

What the server logs at logoff

[2026-09-22T14:26:21.293] [ERROR] Xorg server closed connection
[2026-09-22T14:26:21.294] [INFO ] xrdp_process_main_loop: disconnecting with errinfo 0x0000000c

The second line is one of my temporary log lines, printing self->errinfo immediately before libxrdp_disconnect() in xrdp/xrdp_process.c. 0x0c is ERRINFO_LOGOFF_BY_USER, i.e. correct. It is set by xrdp_mm.c:4082/:4130, not via CCP (see the secondary observation below).

So libxrdp_disconnect() runs its full sequence: error info PDU with 0x0c, then xrdp_rdp_send_deactivate(), then xrdp_rdp_disconnect(). None of them logs a failure. And the client still reports a protocol error.

It is not EGFX / H.264 related

Same client, colour depth forced to 16-bit so the graphics pipeline is refused:

[2026-09-22T14:32:05.829] [WARN ] client requested gfx protocol with insufficient color depth
...
[2026-09-22T14:32:18.692] [ERROR] Xorg server closed connection
[2026-09-22T14:32:18.693] [INFO ] xrdp_process_main_loop: disconnecting with errinfo 0x0000000c

No Matched H264 mode, no egfx created, no encoder. 0xd06 appears exactly the same. So it is the generic teardown path, independent of EGFX, H.264 and any acceleration.

Reproduction

  1. Connect with mstsc (32-bit or 16-bit colour, either works)
  2. Log off from inside the session — via the desktop's logout, not by closing the window
  3. mstsc shows the dialog with 0xd06

Consistent here across every logoff, on both versions.

Secondary observation: the CCP close request never arrives

This turned out not to cause the 0xd06, but it looks like it is not intended either.

xrdp_mm_process_close_ccp_connection_request() logs "Request to close connection : '%s'" before calling xrdp_mm_set_fatal(). That line appears zero times in my logs:

log xrdp version Request to close connection session ends
xrdp.log 0.10.80 0 6
xrdp.log.1.gz (21 Sep) 0.10.6.1 0 4
xrdp.log.4.gz (6 May) 0.10.6.1 0 12

The send side is reached, but the transport is already gone. With a second temporary log line at the top of sesexec_terminate_connected_xrdp_process() (sesman/sesexec/sesexec.c):

[14:26:21.293] xrdp     [ERROR] Xorg server closed connection
[14:26:21.294] xrdp     disconnecting with errinfo 0x0000000c
[14:26:21.295] sesexec  sesexec_main_loop: xrdp connection has exited (client 'DESKTOP-FFGQFME')
[14:26:21.307] sesexec  sesexec_terminate_connected_xrdp_process: reason 3, ccp_trans NULL, status -1
[14:26:21.308] sesexec  sesexec_terminate_connected_xrdp_process: reason 4, ccp_trans NULL, status -1

xrdp notices the module socket closing ~2 ms before sesexec gets to the send, sesexec sees "xrdp connection has exited" and closes the CCP transport, and the two later calls find g_ccp_trans == NULL and return silently because of the guard at sesexec.c:716:

c
if (g_ccp_trans != NULL && g_ccp_trans->status == TRANS_STATUS_UP)

xrdp_mm.c sets ERRINFO_LOGOFF_BY_USER on its own, so nothing is lost in practice — but CCP_CLOSE_LOGOFF_BY_USER then never travels the path it was written for, and the reason mapping in xrdp_mm_ccp.c is unreachable for this case. Happy to open that separately if you would prefer it kept apart from the 0xd06.

What I could not determine

Which of the three PDUs mstsc objects to. That needs either a LOG_DEVEL build or a capture, and I stopped short of both. If it would help, I have a test host with this reproducing reliably and can run an instrumented build or collect whatever trace you want.