[jcifs] NtmlHttpAuthenticationFilter

Eric Glass eric.glass at gmail.com
Thu Jul 29 14:31:22 GMT 2004


> INFO: Server startup in 27390 ms
> ACCESS_VIOLATION
> java.util.ConcurrentModificationException
>       at
> java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:5
> 52)
>       at java.util.LinkedList$ListItr.next(LinkedList.java:488)
>       at jcifs.smb.SmbTransport.tryClose(SmbTransport.java:320)
>       at jcifs.smb.SmbTransport.run(SmbTransport.java:473)
>       at java.lang.Thread.run(Thread.java:534)
> 

If SmbTransport.getSmbSession is called on a transport while the
iterator in tryClose is open, the "sessions.add()" call in the former
will trigger a ConcurrentModification exception in the latter.

Changing to the below synchronizes on the transport for the duration
of the tryClose iteration (line ~320), which I *think* will fix this:

    synchronized (this) {
        ListIterator iter = sessions.listIterator();
        while( iter.hasNext() ) {
            ssn = (SmbSession)iter.next();
            iter.remove();
            ssn.logoff( inError );
        }
    }

(the sessions.clear() call later can be removed, as the iterator
clears the list out as it goes.)

If I had to guess, I'd say you're probably seeing this due to the
"jcifs.smb.client.ssnLimit = 1" (which limits the number of sessions
on a transport to 1).


Eric


More information about the jcifs mailing list