Bug 503176 - krdc RDP tab stays open even on remote logout/disconnect
Summary: krdc RDP tab stays open even on remote logout/disconnect
Status: RESOLVED FIXED
Alias: None
Product: krdc
Classification: Applications
Component: RDP (other bugs)
Version First Reported In: 25.04.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Urs Wolfer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-22 15:44 UTC by Mike Russo
Modified: 2025-04-23 20:06 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 25.04.1
Sentry Crash Report:


Attachments
attachment-620899-0.html (4.25 KB, text/html)
2025-04-23 18:13 UTC, Mike Russo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Russo 2025-04-22 15:44:21 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports

Please remove this comment after reading and before submitting - thanks!
***

SUMMARY
This was not an issue in KRDC from 5.x, new since upgrading to KRDC 6.x with libfreerdp integration (which is great btw and means I can run natively without XWayland).   After logging in to Windows using RDP, if I log out or disconnect (or get idle disconnected), the tab will stay active (with just the last bitmap on the screen) and I have to manually disconnect.  In prior KRDC it would go away. 

STEPS TO REPRODUCE
1. login to Windows via RDP
2. start->sign off or log out or whatever, or disconnect
3. notice that tab is still there, have to press disconnect on KRDC menu or X on tab

OBSERVED RESULT
tab stays up

EXPECTED RESULT
tab should be disposed of

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 6.12.0
Qt Version: 6.8.3

ADDITIONAL INFORMATION
Here are the console messages surrounding the connect and then disconnect 

[11:41:40:543] [2214069:00221bbc] [INFO][com.freerdp.channels.rdpsnd.client] - [rdpsnd_load_device_plugin]: [dynamic] Loaded pulse backend for rdpsnd
[11:41:41:644] [2214069:00221bbc] [INFO][com.freerdp.channels.rdpsnd.client] - [rdpsnd_load_device_plugin]: [dynamic] Loaded pulse backend for rdpsnd
[11:41:41:898] [2214069:00221bbc] [WARN][com.freerdp.channels.drdynvc.client] - [check_open_close_receive]: {Microsoft::Windows::RDS::DisplayControl:14} OnOpen=(nil), OnClose=0x7a7b32e7c040
[11:41:59:446] [2214069:0021c919] [WARN][com.freerdp.channels.drdynvc.client] - [check_open_close_receive]: {Microsoft::Windows::RDS::DisplayControl:14} OnOpen=(nil), OnClose=0x7a7b32e7c040
[11:42:00:235] [2214069:0021c901] [INFO][com.freerdp.core] - [rdp_print_errinfo]: ERRINFO_LOGOFF_BY_USER (0x0000000C):The disconnection was initiated by the user logging off their session on the server.
[11:42:00:235] [2214069:0021c901] [ERROR][com.freerdp.core] - [rdp_set_error_info]: ERRINFO_LOGOFF_BY_USER [0x0001000C]
[11:42:01:810] [2214069:0021c8b5] [WARN][com.freerdp.api] - [input_ensure_client_running]: [APPLICATION BUG] input functions called after the session terminated
[11:42:01:815] [2214069:0021c8b5] [WARN][com.freerdp.api] - [input_ensure_client_running]: [APPLICATION BUG] input functions called after the session terminated
[11:42:01:817] [2214069:0021c8b5] [WARN][com.freerdp.api] - [input_ensure_client_running]: [APPLICATION BUG] input functions called after the session terminated
[11:42:01:819] [2214069:0021c8b5] [WARN][com.freerdp.api] - [input_ensure_client_running]: [APPLICATION BUG] input functions called after the session terminated
[11:42:01:822] [2214069:0021c8b5] [WARN][com.freerdp.api] - [input_ensure_client_running]: [APPLICATION BUG] input functions called after the session terminated
[11:42:01:824] [2214069:0021c8b5] [WARN][com.freerdp.api] - [input_ensure_client_running]: [APPLICATION BUG] input functions called after the session terminated
[11:42:01:826] [2214069:0021c8b5] [WARN][com.freerdp.api] - [input_ensure_client_running]: [APPLICATION BUG] input functions called after the session terminated
[11:42:01:828] [2214069:0021c8b5] [WARN][com.freerdp.api] - [input_ensure_client_running]: [APPLICATION BUG] input functions called after the session terminated
[11:42:01:828] [2214069:0021c8b5] [WARN][com.freerdp.api] - [input_ensure_client_running]: [APPLICATION BUG] input functions called after the session terminated
[11:42:01:830] [2214069:0021c8b5] [WARN][com.freerdp.api] - [input_ensure_client_running]: [APPLICATION BUG] input functions called after the session terminated
Comment 1 Fabio 2025-04-22 21:17:41 UTC
Hum, i need to investigate a bit further on this one, since it's working here (the tab closes on remote disconnect):

[23:15:52:094] [8343:000020ae] [INFO][com.freerdp.core] - [rdp_print_errinfo]: ERRINFO_LOGOFF_BY_USER (0x0000000C):The disconnection was initiated by the user logging off their session on the server.
[23:15:52:094] [8343:000020ae] [ERROR][com.freerdp.core] - [rdp_set_error_info]: ERRINFO_LOGOFF_BY_USER [0x0001000C]
[23:15:52:094] [8343:000020ae] [ERROR][com.freerdp.core.rdp] - [rdp_recv_callback_int][0x4093b970]: CONNECTION_STATE_CAPABILITIES_EXCHANGE_DEMAND_ACTIVE status STATE_RUN_QUIT_SESSION [-2]
[23:15:52:094] [8343:000020ae] [ERROR][com.freerdp.core.transport] - [transport_check_fds]: transport_check_fds: transport->ReceiveCallback() - STATE_RUN_QUIT_SESSION [-2]
[23:15:52:207] [8343:000020ae] [WARN][com.freerdp.channels.rdpsnd.client] - [rdpsnd_check_pulse]: pulse->stream=(nil)
Comment 2 Mike Russo 2025-04-23 17:43:09 UTC
What is the best way to get more information?  For instance, what environment variables can I set to perhaps get more debugging output to help narrow down where the issue may be?
Comment 3 Fabio 2025-04-23 17:44:43 UTC
I use these:
WLOG_LEVEL=DEBUG QT_LOGGING_RULES="KRDC=true" krdc
Comment 4 Mike Russo 2025-04-23 18:13:27 UTC
Created attachment 180581 [details]
attachment-620899-0.html

I'm not sure if it got everything needed, but I did set those two environment variables and ran KRDC and connected to a desktop, then did a disconnect, but the tab stayed up.  Let me know if you want to see a video.

...
[14:08:25:327] [3323673:0032b958] [DEBUG][com.freerdp.channels.rdpgfx.client] - [rdpgfx_recv_evict_cache_entry_pdu]: RecvEvictCacheEntryPdu: ca
cheSlot: 421
[14:08:25:327] [3323673:0032b958] [DEBUG][com.freerdp.channels.rdpgfx.client] - [rdpgfx_recv_evict_cache_entry_pdu]: RecvEvictCacheEntryPdu: ca
cheSlot: 422
[14:08:55:086] [3323673:0032b928] [INFO][com.freerdp.core] - [rdp_print_errinfo]: ERRINFO_RPC_INITIATED_DISCONNECT (0x00000001):The disconnection was initiated by an administrative tool on the server in another session.
[14:08:55:086] [3323673:0032b928] [ERROR][com.freerdp.core] - [rdp_set_error_info]: ERRINFO_RPC_INITIATED_DISCONNECT [0x00010001]
[14:08:55:086] [3323673:0032b928] [DEBUG][com.freerdp.core.rdp] - [rdp_read_header][0x5fb9d83c8410]: DisconnectProviderUltimatum: reason: 1
[14:08:55:087] [3323673:0032b928] [DEBUG][com.freerdp.core.rdp] - [rdp_finalize_reset_flags][0x5fb9d83c8410]: [CONNECTION_STATE_ACTIVE] reset finalize_sc_pdus
[14:08:55:087] [3323673:0032b928] [DEBUG][com.freerdp.core.rdp] - [rdp_client_transition_to_state][0x5fb9d83c8410]: CONNECTION_STATE_ACTIVE -->
CONNECTION_STATE_INITIAL
[14:08:55:091] [3323673:0032b958] [WARN][com.freerdp.channels.drdynvc.client] - [check_open_close_receive]: {Microsoft::Windows::RDS::DisplayControl:17} OnOpen=(nil), OnClose=0x70e48fe05040
[14:08:55:091] [3323673:0032b928] [DEBUG][com.freerdp.channels.audin.client] - [audin_pulse_context_state_callback]: context state PA_CONTEXT_TERMINATED
KRDC: RemoteView::Disconnected
[14:09:14:399] [3323673:0032b719] [WARN][com.freerdp.core] - [input_ensure_client_running]: [APPLICATION BUG] input functions called after the
session terminated
[14:09:14:401] [3323673:0032b719] [WARN][com.freerdp.core] - [input_ensure_client_running]: [APPLICATION BUG] input functions called after the
session terminated
...  (many repeated messages about input because i had moved my mouse over the window)
[14:09:17:806] [3323673:0032b719] [WARN][com.freerdp.core] - [input_ensure_client_running]: [APPLICATION BUG] input functions called after the
session terminated

After clicking the X to close the tab that was stuck:

KRDC: Stopping RDP session
KRDC: RDP session stopped
KRDC:
KRDC: saving window size: QSize(1536, 896)
KRDC: -1
KRDC: -1
KRDC: 0
KRDC: 0




-----Original Message-----
From: Fabio <bugzilla_noreply@kde.org<mailto:Fabio%20%3cbugzilla_noreply@kde.org%3e>>
Reply-To: bug-control@kde.org<mailto:bug-control@kde.org>
To: mike@papersolve.com<mailto:mike@papersolve.com>
Subject: [krdc] [Bug 503176] krdc RDP tab stays open even on remote logout/disconnect
Date: 04/23/2025 01:44:43 PM

https://bugs.kde.org/show_bug.cgi?id=503176

--- Comment #3 from Fabio <ctrlaltca@gmail.com<mailto:ctrlaltca@gmail.com>> ---
I use these:
WLOG_LEVEL=DEBUG QT_LOGGING_RULES="KRDC=true" krdc
Comment 5 Bug Janitor Service 2025-04-23 19:53:05 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/krdc/-/merge_requests/180
Comment 6 Fabio 2025-04-23 19:54:08 UTC
Thank you for the detailed logs, I think I've found the bug and fixed it.
Comment 7 Fabio 2025-04-23 19:54:46 UTC
Git commit 9c53100d0d6a92202dd551963b6234cd0e2c3e5a by Fabio Bas.
Committed on 23/04/2025 at 19:52.
Pushed by ctrlaltca into branch 'master'.

RDP: ensure rdpview gets closed on session disconnect

M  +1    -1    rdp/rdpview.cpp

https://invent.kde.org/network/krdc/-/commit/9c53100d0d6a92202dd551963b6234cd0e2c3e5a
Comment 8 Fabio 2025-04-23 19:57:55 UTC
Git commit 65f48d148724fe3e482548046008e9704675a5a2 by Fabio Bas.
Committed on 23/04/2025 at 19:55.
Pushed by ctrlaltca into branch 'release/25.04'.

RDP: ensure rdpview gets closed on session disconnect


(cherry picked from commit 9c53100d0d6a92202dd551963b6234cd0e2c3e5a)

Co-authored-by: Fabio Bas <ctrlaltca@gmail.com>

M  +1    -1    rdp/rdpview.cpp

https://invent.kde.org/network/krdc/-/commit/65f48d148724fe3e482548046008e9704675a5a2
Comment 9 Mike Russo 2025-04-23 20:06:22 UTC
Confirmed, that did it, thanks!