[jcifs] Re: jcifs.smb.Dfs bugs

Michael B Allen miallen at ioplex.com
Fri Apr 25 17:37:24 GMT 2008

On Thu, 24 Apr 2008 16:40:32 +0200
Ronny Schuetz <Usenet.r96 at gishpuppy.com> wrote:

> Hi Mike,
> >>> Btw, accesses to "referrals" cache are unsynchronized, I think this 
> >>> needs to be changed as well as there is only one static Dfs instance.
> >> True. Some maps should be synchronized. I'll create an update for this.
> > 
> > Ronny,
> > 
> > Make the jcifs.smb.client.Dfs.resolve() method synchronized:
> > 
> >   public synchronized DfsReferral resolve(String domain, ...
> > 
> > and try your tests again. I wouldn't be surprised if that fixed all of
> > your DFS related issues.
> > 
> > Note that you can also temporarily reduce jcifs.smb.client.dfs.ttl to
> > say 10 seconds to really stess the DFS cache code.
> I did that. Actually a bit different, as the referrals cache is used in 
> #insert as well.


Please try this package:


It has the thread-safe DFS cache changes and the getTrustedDomains
lookup fix.

> So to be on the safe side, I just added a new lock 
> object "referralsLock" to the class and synchronized the blocks using 
> the referrals cache in #resolve and #insert. dfs.ttl is set to 15s as well.

Well you don't need to use a separate object. Just synchronize on
SmbFile.dfs around the insert. See 1.2.20c code.


Michael B Allen
PHP Active Directory SPNEGO SSO

More information about the jcifs mailing list