[jcifs] Issues with connections to servers that reboot

Simon simon-samba at weatherill.org
Wed Jun 22 05:36:57 MDT 2011


I believe this is the same bug I reported in April (thread = looping on 
disconnect):

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

On 6/21/2011 10:27 PM, Michael B Allen wrote:
> Hi Sean,
>
> JCIFS should definitely recover gracefully from a server restart. I
> have not checked that sort of thing in quite a while so it's very
> possible there is a bug there. I have added it to the TODO list for
> further investigation.
>
> But I'm not sure if you can do anything about the daemon threads -
> that's just a networking thing (although it so happens that I just
> applied a change that might affect how long those threads hang
> around).
>
> Mike
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20110622/8109e940/attachment.html>


More information about the jCIFS mailing list