While designing a TS farm for one of my clients I recently got to know too much about the Windows 2003 Terminal Services Session Directory. Windows 2008 renamed this to Terminal Services Session Broker.  This little service basically tracks which user is logged onto which terminal server within a TS farm. Without this session directory, users’ sessions can get orphaned, resulting in wasted resource consumption.

In summary the basic configuration is to have multiple TS servers in a farm. These servers can be load balanced using DNS round robin, hardware load balancers (e.g. Alteons), software load balancers (e.g. HAProxy – very good software BTW!!) or Windows NLB. Each of the TS servers are configured with the TS session directory.

When a user connects to the TS, the TS checks for an existing session for the user by contacting the TSSD. If the user does not have a session, the TS allocates a session and allows the user to attempt to logon. If an existing session if found within the farm, the TS issues a RDP redirect (the RDP client needs to be XP or more recent to support this) to the server with the existing session.

This is all good and well, but what happens with the TSSD is unavailable (e.g. during patching or other maintenance windows)?

  • Contrary to some documents, users can still logon to the TS servers with the TSSD being unavailable.
  • Some documents indicate that the TSSD database is cleared when the TSSD service is restarted. This is not the case either. The TSSD service stores the existing sessions in a jet db under %systemroot%system32tssesdir and will reload the database if it is deemed fresh enough. (I never did find out the definition of “fresh enough”). The tssdis.log file (which needs to be enabled) shows this behaviour.
  • MS documents also indicate there is no way to move this database (well for Windows 2003 anyway).

The problem arises when users logon or logoff from the TS servers while the TSSD is unavailable as the TSSD database will have no record of the users’ sessions – again potentially resulting in orphaned sessions.

 The Microsoft documented method to overcome this is to cluster the TSSD service. That sounds good, but what about the TSSD database being under c:windowssystem32? Well the long and the short of it is that the TSSD is cluster aware. However, MS fail to mention that by running the TSSD on server with MSCS installed the TSSD service assumes it will be clustered and expects to be in a cluster service group. The next assumption is makes is that it can use the disk resource in the service group.

In short, the TSSD service can be clustered. When part of the cluster the TSSD service transparently moves its jet database onto one of the shared drives within the service group to provide a HA TSSD service. There is a MS document describing the addition of the TSSD into a cluster but it does not mention that the database is simply silently moved.

The setup document is at http://www.microsoft.com/windowsserver2003/techinfo/overview/sessiondirectory.mspx

(Apparently within Windows 2008 the location of the TSSB database can be changed by altering HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTssdisParameters)

A decent article explaining the TSSD concept more fully is available at http://www.brianmadden.com/blogs/brianmadden/archive/2004/11/30/understanding-the-terminal-server-session-directory.aspx Note that no mention of the tssesdir directory being moved, when clustered, is made however.

Hi,

Well a quick update on the training front. Over the past few weeks I have ramped up the training after my lay-off from the Sinusitis. I can tell I have lost a serious amount of fitness and will battle to get to any decent level of fitness for my Swiss 70.3 race in 59 days time. I have done some good sessions in the gym and some medium paced outside runs. I was getting  a good rise in my TSS score. I say was because I appear to have picked up a sniffle and a scratchy throat.

I will ease off training for the next couple of days to try and shake this cold before it develops into anything serious. If I don’t shake it soon I fear that my Swiss 70.3 race may need to be called off. This year is not turning out well from a health and fitness point of view…

Well I am trying to upgrade MailScanner on one of my servers. Alas, these upgrades are never straight forward. The MailScanner upgrade went reasonably smoothly but when it came to starting MailScanner the problem showed itself. Starting MailScanner resulted in the following error:

root@host:/opt/MailScanner/bin# ./MailScanner
 is only avaliable with the XS version at /usr/local/share/perl/5.8.7/Compress/Zlib.pm line 9
BEGIN failed--compilation aborted at /usr/local/share/perl/5.8.7/Compress/Zlib.pm line 9.
Compilation failed in require at /opt/MailScanner/lib/MailScanner/SA.pm line 42.
BEGIN failed--compilation aborted at /opt/MailScanner/lib/MailScanner/SA.pm line 42.
Compilation failed in require at ./MailScanner.orig line 110.
BEGIN failed--compilation aborted at ./MailScanner.orig line 110.
root@host:/opt/MailScanner/bin#

The root of the error is the message about “is only avaliable with the XS version” within Compress/Zlib.pm line 9. There are a few posts relating to this but no real resolutions. One of the common suggestions, which works for a few people it seems, is to force reinstall the Scalar::Util Perl module. Use “force install Scalar::Util” from within the CPAN shell. This didn’t work for me.

I tried a short test script to try reproduce the problem:

use Scalar::Util qw(dualvar);
use Compress::Zlib;
print "$Scalar::Util::VERSIONn";
my $foo = dualvar 10, "Hello";
print "$foon";

This worked which indicates that the XS functionality is working properly.

I figured it might be related to the load order of the libraries. For MailScanner 4.79.11-1 I managed to work around this problem by inserting

use Scalar::Util qw(dualvar);

in at line 38 (just after “require 5.005;”). This appears to load the Scalar::Util XS functions before MailScanner alters the library search paths.

Hopefully this helps someone else with this problem.

I recently encountered a problem while upgrading the iLO2 firmware on a HP DL360G5 server. It seems if you reopen the remote console window while remotely updating the iLO2 firmware you can corrupt the firmware upgrade process. Hmm. This caught me out. When I rebooted my server it sat there not beeping or doing anything for a couple of minutes. I thought I had toasted it. I started attempting ROM recovery process (flipping dip switches on the motherboard btw) but this didn’t help. Removing the RAM caused the server to beep so it was obviously not totally dead. During one of my “boot- nothing-google-retry” cycles I left the server running. After about 10 minutes the server beeped and continued booting up – BUT the POST results showed no iLO2. So I figured it was a iLO firmware problem (which until then I had thought it was a ROM problem) which changed my google terms. I eventually found HP document c01850906.

The document outlines a process for recovering from a corrupt iLO2 firmware update.

The document describes it better but the steps are pretty much the following:

Boot off maintenance CD (have patience, the boot might take 10 or so minutes)

run firmware update
ctl-alt dbx

alt-ctrl-1  enter
cd /mnt/bootdevice/compaq/swpackages
rmmod hpilo
rmmon ilo
sh CP012108.scexe –direct

Message about firmware 1.81 and programming flash

reboot

The full process is at:

 http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c01850906

Document c01850906