[jcifs] looping on disconnect

Simon simon-samba at weatherill.org
Wed Apr 20 13:59:34 MDT 2011


By looking at the 1.3.15 code, I believe this bug still exists. If 
connectivity is lost before jCIFS disconnects, then the 
SmbTransport.doDisconnect() will be called over and over again. Adding a 
try/catch block could stop that:

     protected void doDisconnect( boolean hard ) throws IOException {
         ListIterator iter = sessions.listIterator();
         try {
             while (iter.hasNext()) {
                 SmbSession ssn = (SmbSession)iter.next();
                 ssn.logoff( hard );
             }
             socket.shutdownOutput();
             out.close();
             in.close();
             socket.close();
         } catch( IOException ioe ) {
             if (!hard)
                 throw e;
         }
         digest = null;
     }

Thanks,
Simon

On 4/20/2011 12:11 PM, Simon wrote:
> We're using jCIFS 1.3.13 and just encountered an endless loop that 
> effectively took down our application servers. The following appeared 
> in our logs more than 129 million times!
>
> 2011-04-14 18:24:07,766 ERROR [STDERR] (Transport3) 
> java.net.SocketException: Socket is closed
> 2011-04-14 18:24:07,766 ERROR [STDERR] (Transport3)     at 
> java.net.Socket.shutdownOutput(Socket.java:1407)
> 2011-04-14 18:24:07,766 ERROR [STDERR] (Transport3)     at 
> jcifs.smb.SmbTransport.doDisconnect(SmbTransport.java:358)
> 2011-04-14 18:24:07,766 ERROR [STDERR] (Transport3)     at 
> jcifs.util.transport.Transport.disconnect(Transport.java:210)
> 2011-04-14 18:24:07,766 ERROR [STDERR] (Transport3)     at 
> jcifs.util.transport.Transport.loop(Transport.java:122)
> 2011-04-14 18:24:07,766 ERROR [STDERR] (Transport3)     at 
> jcifs.util.transport.Transport.run(Transport.java:257)
> 2011-04-14 18:24:07,766 ERROR [STDERR] (Transport3)     at 
> java.lang.Thread.run(Thread.java:662)
>
> Can I get the source for 1.3.13 somewhere? I have 1.3.8 and the latest 
> (1.3.15), but can't find 1.3.13.
>
> My guess is that the exception is causing the connection to be left in 
> an open state only to attempt another disconnect (which fails). Seeing 
> the actual source may help finding out what is going on.
>
> Thanks,
> Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20110420/632df627/attachment.html>


More information about the jCIFS mailing list