Resolving Persistent Citrix Sessions: A Guide to Graceful Session Closure

Identifying and Managing Background Processes to Ensure Efficient Resource Management in Citrix Environments

Website Visitors:
Contents

Citrix Sessions Not Logged Off Gracefully After Closing The Application

Citrix environments are widely used for remote application delivery, allowing users to access applications and desktops hosted on a server. However, users may encounter issues where sessions do not close gracefully after an application is closed. This article discusses a specific issue where sessions remain active due to certain processes, particularly those related to antivirus software and other system utilities, and provides a detailed solution to resolve this problem.

In a typical Citrix session, when a user closes an application, the expectation is that the session will transition from an active state to a disconnected state, allowing resources to be freed up on the server and close/terminate the disconnected session as per the policy. However, in some cases, users have reported that even after closing the application, the session remains visible in the Citrix Workspace Connection Center, indicating that it is still active. Session remains active on the Citrix app server as well.

  1. Session Persistence: The Citrix session remains active even after the application is closed.
  2. Visible in Connection Center: The session continues to appear in the Citrix Workspace Connection Center.
  3. Running Processes: Certain processes, particularly those related to antivirus software (e.g., Trend Micro or Symantec) or other system management tools, continue to run under the user’s ID, preventing the session from closing.

The primary reason for this issue is that certain processes do not allow the Citrix session to transition to a disconnected state. These processes can include antivirus clients, system monitoring tools, or any other applications that may be running in the background. When these processes are active, they can interfere with the normal logoff procedures of Citrix, causing the session to remain in an active state.

To resolve the issue of persistent Citrix sessions, a modification to the Windows registry is required. This involves adding specific executable files to a registry key that Citrix uses to check for running processes before allowing a session to close.

  1. Identify Persistent Processes:

    • After the user closes the application, verify that the session is still active.
    • Log in to the application server via Remote Desktop Protocol (RDP).
    • Open the Task Manager and navigate to the Details tab.
    • Look for processes running under the user’s ID. Focus on processes that are not part of the standard Citrix environment.
  2. Terminate Problematic Processes:

    • Start with antivirus processes, such as those from Symantec or Trend Micro etc. If you find any running, terminate them.
    • Check the Citrix Connection Center on the user’s end to see if the session is removed after closing the application.
    • If the session remains, continue to identify and kill any other non-Citrix processes that are running under the user’s ID.
  3. Modify the Registry:

    • Open the Windows Registry Editor (regedit) on the app server (VDA).
    • Navigate to the following registry key:
      1
      
      HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Citrix\wfshell\TWI
      
    • Identify LogoffCheckSysModules key. Create the key if it doesn’t exist (String Value Key). Modify it if you find the key.
    • Add the executable names of the identified processes, separated by commas and without spaces. For example:
      1
      
      BESClientUI.exe,Notifier.exe,dsa-wrs-app.exe
      

      Do not remove existing values if you find the key with process names already present. Add the processes names that you’ve identified to the existing list if the key already exists.

If you identified the following processes as problematic:

  • BESClientUI.exe
  • Notifier.exe
  • dsa-wrs-app.exe

You would set the registry value as follows:

  • Name: LogoffCheckSysModules
  • Value: BESClientUI.exe,Notifier.exe,dsa-wrs-app.exe
  • Backup the Registry: Before making any changes to the registry, it is crucial to back it up to prevent any unintended consequences.
  • Administrative Privileges: Ensure that you have administrative privileges to modify the registry.
  • Testing: After making the changes, test the Citrix session to confirm that it now closes gracefully when the application is terminated.

Persistent Citrix sessions can lead to resource management issues and affect user experience. By identifying and terminating specific processes that interfere with session closure, and by modifying the registry to include these processes, administrators can ensure that Citrix sessions transition to a disconnected state as intended. This solution not only improves resource management on the server but also enhances the overall user experience in a Citrix environment.

Want to learn more on Citrix Automations and solutions???

Subscribe to get our latest content by email.

If you like our content, please support us by sponsoring on GitHub below: