[jcifs] Timeout problem with jcifs NTLM HTTP authentication

Michael B Allen mba2000 at ioplex.com
Thu Nov 18 18:28:23 GMT 2004

On Thu, 18 Nov 2004 17:43:17 +0100
<Paul.Holaj at dekabank.de> wrote:

> In our web application, we noticed that during this period of time
> sometimes our applications' pages didn't respond and returned a timeout
> error after several minutes:
> Servlet failed with IOException
> jcifs.smb.SmbException: An error occured sending the request.
> java.net.ConnectException: Connection timed out
> ...
> With a network trace we found out, that the timeout occured every time
> when jcifs choose the offline DC from the list.
> Isn't jcifs supposed to switch through the list of DC's until it finds a
> responding DC ? Or do I have to set a jcifs timeout configuration
> parameter ?

Yes and yes. What the getChallengeForDomain() code does is roughly [1]
as follows:

   if (list_expiration expired) {
      dc_list = lookup all domain controllers again
       // cachePolicy set to 10min by filter
      list_expiration = now() + jcifs.netbios.cachePolicy
   for each dc in dc_list {
      try {
         communicate w/ dc
         return dc.challenge
      } catch {
         dc_list[i] = null // dc no good
   throw Exception

So every 10 minutes the list expires and refreshes itself so that when
you fix the bad dc it's used again. You could increase the cachePolicy
value to reduce the number of exceptions or change the loglevel to 1 to
simply ignore them.

The best solution is to fix the bad DC ;->


[1] See top of jcifs/smb/SmbSession.java for details:

Greedo shoots first? Not in my Star Wars.

More information about the jcifs mailing list