Index: trunk/server/common/oursrc/whoisd/whoisd.tac
===================================================================
--- trunk/server/common/oursrc/whoisd/whoisd.tac	(revision 1740)
+++ trunk/server/common/oursrc/whoisd/whoisd.tac	(revision 1741)
@@ -65,7 +65,8 @@
 #            return vhost + ".mit.edu"
     def searchLDAP(self, vhost):
-        results = self.ldap.search_s(self.ldap_base, ldap.SCOPE_SUBTREE,
+        results = self.ldap.search_st(self.ldap_base, ldap.SCOPE_SUBTREE,
             ldap.filter.filter_format(
-                '(|(apacheServername=%s)(apacheServerAlias=%s))', (vhost,)*2))
+                '(|(apacheServername=%s)(apacheServerAlias=%s))', (vhost,)*2),
+                timeout=5)
         if len(results) >= 1:
             result = results[0]
@@ -84,9 +85,17 @@
         vhost = self.canonicalize(vhost)
         info = self.vhosts.get(vhost)
-        if not info:
-            info = self.searchLDAP(vhost)
+        tries = 0
+        while (tries < 3) and not info:
+            tries += 1
+            try:
+                info = self.searchLDAP(vhost)
+            except (ldap.TIMEOUT, ldap.SERVER_DOWN):
+                self.ldap.unbind()
+                self.ldap = ldap.initialize(self.ldap_URL)
         if info:
             ret = "Hostname: %s\nAlias: %s\nLocker: %s\nDocument Root: %s" % \
                 (info['apacheServerName'], vhost, info['locker'], info['apacheDocumentRoot'])
+        elif tries == 3:
+            ret = "The whois server is experiencing problems looking up LDAP records.\nPlease contact scripts@mit.edu for help if this problem persists."
         else:
             ret = "No such hostname"
