Terminal Server sessions are not automatically closing

bsodterminal-server

I have users running an application on a terminal server using a shortcut that has "Start the following program on connection".

Normally when they exit the application the terminal server session automatically logs out.

Sometimes when the application exits their session doesn't end. They are left with a 'blue screen' (a blank desktop). They usually disconnect and wait for the disconnection timeout to automatically logout their session.

My question is what would cause the session to stay stuck open after the application quits?

I have tried updating to the later RDP client.
The clients are XP sp3. The server is Server 2003 R2 SP2.

The clients are using redirected Desktops and My Documents folder, and roaming profiles. There was a permission problem on the Desktop and Documents folders that was causing an error to be logged that redirection failed. I took ownership of the folders and subfolders in the user's name and that fixed that error from being logged but didn't fix the 'blue screen' problem.

Best Answer

My question is what would cause the session to stay stuck open after the application quits?

Bugs in the application that got started, or bugs in something else that is loaded when the user connects can cause something like this.

Sometimes filehandles or registry handles are left open. Usually you can track this things down using filemon or regmon. You may also want to try oh.exe (open handles) that is part of the 2003 resource kit.

If you haven't already you may want to trying installing the User Profile Hive Cleanup Service. It is supposed to help force things closed after disconnection.