Session remains active after logoff from a Published application

In Citrix delivery services console we had many sessions in a down state. After a gracefull logoff the session remains active. Logoff/reset isn’t possible. Al sessions had the same process csrss.exe running.
Csrss.exe is a system process that must running in every session. Normally csrss.exe is killed by logoff. So what causes the process remains open?

Down Sessions 210814

 

CSRSS.exe2

After some troubleshooting I found an application process that is causing csrss.exe to remains open. After killing this application process, session logoffs gracefully.

You can find the bad application process by:
Opening the session properties in Citrix delivery services console and lookup the session id. Go to the task manager and look up the processes running under that session id. Kill them one by one.Eventually after killing the right process the session logsoff. This application process is causing the sessions stays active.
A quick and simple solution for this problem is uninstall the application .

But what if you really need that application?
Then you can add the process causing this problem to the following regkey (without quotation marks): HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Citrix\wfshell\TWI LogoffCheckSysModules REG_SZ = “your process.exe”